SphereCommunity
How do you ? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: How do you ? (/Thread-How-do-you)



How do you ? - Dullais - 04-09-2013 02:32 AM

Hei guys, this one is embarrassing, how do you chenk, if string contains numbers and/org letters and / or spaces ? I really can't figure this one out Sad Iam sorry for dumb question...


RE: How do you ? - Mordaunt - 04-09-2013 03:39 AM

http://wiki.sphere.torfo.org/index.php/Chapter_10#STRMATCH


RE: How do you ? - Dullais - 04-09-2013 03:54 AM

(04-09-2013 03:39 AM)Mordaunt Wrote:  http://wiki.sphere.torfo.org/index.php/Chapter_10#STRMATCH

Thank you man, but i already drilled this and i just cant get it... how do i combine ? And what are thoes simbols in exaple ? what do they mean ? What the hell is this ? - ^[-+]? Its not sad in spherewiki...
Beleve me, i try myself first, and if i cant get, i come to ask you guys Smile not Other way around...


RE: How do you ? - Pidrila - 04-09-2013 05:31 AM

for spaces here is an example like spherewiki shows :
Code:
IF (STRMATCH(*ex*, <ARGS>))
// will explain the (*ex*, <ARGS>) // *ex* - * is space, ex word, * - space! <ARGS> the words what player is typing..


RE: How do you ? - RanXerox - 04-09-2013 08:12 AM

What you probably don't understand is the concept of "regular expression"... if so, check this out: http://en.wikipedia.org/wiki/Regular_expression

A regular expression for "string contains numbers and/org letters and / or spaces" is impossible... make up your mind, is it AND or OR or both ;-)

An example Sphere IF statement that uses a regular expression to validate "string ONLY contains numbers or letters or spaces" would look like this:

Code:
if ( strregex(^[A-Za-z0-9 ]+$,<local.string>) )



RE: How do you ? - Dullais - 04-09-2013 07:03 PM

(04-09-2013 05:31 AM)Pidrila Wrote:  for spaces here is an example like spherewiki shows :
Code:
IF (STRMATCH(*ex*, <ARGS>))
// will explain the (*ex*, <ARGS>) // *ex* - * is space, ex word, * - space! <ARGS> the words what player is typing..

Thanks man, but...
Tu jau zini kā ir ar to video par latviešu valodu, kad 2 latvieši satiekas, un sarunājas krievieski. Mums te ir sanācis apmēram tas pats Big Grin

(04-09-2013 08:12 AM)RanXerox Wrote:  What you probably don't understand is the concept of "regular expression"... if so, check this out: http://en.wikipedia.org/wiki/Regular_expression

A regular expression for "string contains numbers and/org letters and / or spaces" is impossible... make up your mind, is it AND or OR or both ;-)

An example Sphere IF statement that uses a regular expression to validate "string ONLY contains numbers or letters or spaces" would look like this:

Code:
if ( strregex(^[A-Za-z0-9 ]+$,<local.string>) )

Thanks man, wikipedia page did really explain to me, what does thoes +^. an other means, So now everything is about right Smile Thanks for that Smile