Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Identifying upper and lower case letters

Author
Message
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 19th Dec 2022 02:47
I am looking for information to allow me to identify a letter in a string as upper or lower case.
I want the e in "Hello World" to be identified in AGKS as being lower case.
Currently if I tell my program to get the second letter of that string it only identifies it as an E and not different from e.
I need a command that says "E" is different than "e".
Please help.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Dec 2022 03:15 Edited at: 19th Dec 2022 03:17


You got upper and lower as string codes to use to find out what is what.


hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 19th Dec 2022 04:01
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 19th Dec 2022 04:23
Something like this?

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 19th Dec 2022 07:26 Edited at: 19th Dec 2022 07:27
in case you want to check whether or not a given character is even Alpha before you bother to check its case:

ASCII Table in case you want to identify Numeric or something else, similarly.
Bored of the Rings
User Banned
Posted: 19th Dec 2022 11:25 Edited at: 19th Dec 2022 18:38
yes, if your just checking if a char is upper or lower case just write a quick function to see if the ASCII range is 65-90 for upper case chars and 97-122 for lower case chars.
Pro Programmer / Data Scientist, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Dec 2022 15:48
In case you're wondering where this number range comes from, look here:

https://www.asciitable.com/
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda
Pixel-Perfect Collision

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Bored of the Rings
User Banned
Posted: 20th Dec 2022 19:11 Edited at: 20th Dec 2022 19:13
An example, change depending if you want to return numeric or character value. There are different functions you can do with this.
I didn't add an ascii table as users above already added link(s) This code was quickly written in the most up-to-date version of AppGameKit Studio. I've set invalid chars to 'x', but you can handle it differently if you want.

Pro Programmer / Data Scientist, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 23rd Dec 2022 17:55
Thank you to all contributors.
What I'm trying to do is GetA Raw Key with any of the keyboard keycodes and determine if it is upper or lower case.
GetRawKey is general. It does not differentiate.
GetRawLastKey cannot be cleared so if it's used in a loop to add to a string It becomes an infinite loop of that key added. When I check for new key not being the same I can break the loop BUT cannot use the same key again.

I did go to UPPER to check and Upper what I'm looking for. That worked. Used that as a work around for what I initially wanted to do.

I have a List of 1000 items in alphabetical order.
I input the first letter of my search into a string.
I reverse search The List noting the last location in the list.
That becomes my first line of print for 20 rows.
I then press another letter and add it to the search string and repeat the process getting a new first Line
The process is repeated until I accept one of the listed items with a mouse click.
I was hoping for a Keystroke I couldn't find would have accomplished the upper/lower difference

Sorry I don't know how to add a Snippet here.
This is what I did to accomplish what allowed me to get past the Upper/Lower case List.


` MySong$ = The keystrokes I've been entering for the Title I want

For Y = 1000 to 1 Step - 1
ChkLeft$ = left(SongNames$[Y], Len(MySong$) ` Gets the Required number of characters to check
If Upper(ChkLeft$) > Upper(MySong$) then FirstSong = Y - 1 `Remember the location of the last valid check
Next

`Then I Print the new list to screen as Text Objects and select the one I want or enter another letter


I do a lot of non gaming design and database work and loved DBPro.
I am struggling with the syntax changes and loss of many commands that DBPro had that AGKS doesn't
Thank You Everyone.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Dec 2022 06:03
Is your search case-sensitive? If not, then there's an easier way than looking at every character.

I've included two simple functions: isUpper() and isLower()
Also, maybe the command you're looking for is getCharBuffer(). Just keep in mind it can return more than 1 character at a time if you mash the keyboard fast enough.

Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda
Pixel-Perfect Collision

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Grumpydlw
10
Years of Service
User Offline
Joined: 2nd Nov 2013
Location: Las Vegas, Nevada
Posted: 30th Dec 2022 19:49
My Code finds the first occurrence of the List that is greater than my search criteria.
I then list the previous line and the following 19 giving me a list of 20 that could contain the line I'm looking for.
If it hasn't gone far enough I enter another letter and check again.

Thanks for all the help and the reminder of using Upper and Lower.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Jan 2023 22:22
If you can sort your data set, a binary search would be the fastest method.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda
Pixel-Perfect Collision

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-03-29 11:45:15
Your offset time is: 2024-03-29 11:45:15