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 ImageImage
B
167
S
50
G
159
Posts: 8,168
Reputation: 102,932

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
41
S
8
G
9
Posts: 1,219
Reputation: 8,064

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 ImageImage
B
167
S
50
G
159
Posts: 8,168
Reputation: 102,932


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests