Spaces - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: General Help (/Forum-General-Help) +--- Thread: Spaces (/Thread-Spaces) |
Spaces - Runcuks - 12-04-2013 10:47 PM Hi, could someone tell me how to players to use spaces when they choose name for example " MyNickname" "MyNickname " I came up with something like this but it didnt work IF (STRMATCH(* *, <ARGTXT[0]>)) || (STRMATCH( *, <ARGTXT[0]>)) || (STRMATCH(* , <ARGTXT[0]>)) src.sysmessage @023 You can not use spaces. return 1 ENDIF RE: Spaces - Mordaunt - 12-04-2013 11:06 PM Because you are comparing ARGTXT against.... nothing. http://wiki.sphere.torfo.org/index.php/Chapter_10 If you refer to the link I have posted, you'll find a few methods, inclusing STRPOS which can be used to find spaces in a string. You should be able to do it with STREGEX also using <ch 32> to detect spaces (I think... haven't run a test to make sure) RE: Spaces - Khaos - 12-04-2013 11:29 PM This possibly might work. PHP Code: if strmatch("* *","<src.name>") Try removing the quotes if it gives you an issue. RE: Spaces - Runcuks - 12-04-2013 11:55 PM (12-04-2013 11:29 PM)Khaos Wrote: This possibly might work. Jup that worked thanks! RE: Spaces - Khaos - 12-05-2013 01:01 AM You are quite welcome. RE: Spaces - Feeh - 12-05-2013 08:00 AM What about STRTRIM? You can use it to remove spaces http://wiki.sphere.torfo.org/index.php/Chapter_10#STRTRIM if (STRMATCH(*32*,<asc <ARGTXT[0]>>)) SYSMESSAGE "No spaces allowed!" RE: Spaces - XuN - 12-05-2013 09:06 AM StrTrim only works for spaces at begin of given string, if you want to remove any spaces from the text they Input use <asciiremove 32,<argtxt[0]>> Code: [function asciiremove] |