Get Text Character from String

For questions about using Classic.

Post » Sun Sep 19, 2010 6:13 pm

Is it possible to take a text object and pick the individual characters from it?

For example, Text = "Lorem Ipsum..."

Text.GetChar(1) = "L"
Text.GetChar(2) = "o"
Text.GetChar(3) = "r"
Text.GetChar(4) = "e"
Text.GetChar(5) = "m"

I wish to have a separate app allow the user to input information and have it generate a keycode based on that input.
B
1
G
2
Posts: 5
Reputation: 635

Post » Sun Sep 19, 2010 7:34 pm

I don't think there's a way to get a single character from a string, but I'd be willing to bet you can with Python.
Image Image
B
161
S
48
G
90
Posts: 7,354
Reputation: 66,763

Post » Sun Sep 19, 2010 8:00 pm

You can do it with these system expressions:
http://sourceforge.net/apps/mediawiki/c ... sions#Text

This is the one you want specifically:

Mid(string, index, N)
Returns the N characters after index in string.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Sep 19, 2010 10:00 pm

Well then that should be reworded shouldn't it?
Character, not characters.
Still don't see exactly how that would work tho....

mid(string,index,last.index)?

Or is N the number of characters you want returned?
Image Image
B
161
S
48
G
90
Posts: 7,354
Reputation: 66,763


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests