retrieving the XY-Position in a string

Windows specific forum
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

retrieving the XY-Position in a string

Post by Hroudtwolf »

Dear comunity,

Thats my prob....

I want to search a string in a string. If the string was found, i need the XY-position from the foundet string in my string.
I tried a lot of thing. My brain already A knot.

Is there anyone who can help me ? :cry:
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: retrieving the XY-Position in a string

Post by PB »

Use the FindString command. If it returns 0, the string inside the string
wasn't found. Anything other than 0 is the X position of the found string.
There is no Y position because strings are one-dimensional, unless you
use two-dimensional strings but then that requires a bit more work.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

I get my string from a editorgadget. This string has virtualy two dimensions.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I get my string from a editorgadget

PureBasic strings are only one dimensional. You can't get the text from an
EditorGadget in two dimensions, unless you store it in two different strings.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

if your string is formated like "10,5" then use

Code: Select all

X=StringField(String.s,1,",")
Y=StringField(String.s,2,",")
~Dreglor
Post Reply