SphereCommunity
Cutting String in the right format - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Cutting String in the right format (/Thread-Cutting-String-in-the-right-format)



Cutting String in the right format - admin phoenix - 10-02-2012 05:08 PM

Hi guys,

yesterday I tried to cut a string via some string function. at the end I got it but it is to large for my mind, I think so.
I used every string function.
Haven´t the script here but the strings are
s_circle_fire_1 or s_circle_fire_2 or ....s_circle_fire_10
I only need the string "circle_fire" at the end and I need it with one function
like f_cut_circle_word s_circle_1
first of all, I cut the s_ down and made a reverse


after that I cut the 1_,2_ .... 10_ down and reversed it back
so the code is very large Smile
Someone knows a lighter version?

Code:
LOCAL.LENGTH = <EVAL STRLEN(<ARGS>)>
LOCAL.NAME=<STRREVERSE <STRSUB 2 <dLOCAL.LENGTH>  <args>>>
LOCAL.LENGTH = <EVAL STRLEN(<LOCAL.NAME>)>
LOCAL.POS = <EVAL <STRPOS 0 _ <LOCAL.NAME>>+1>
LOCAL.NAME = <STRREVERSE <STRSUB <dLOCAL.POS> <dLOCAL.LENGHT> <LOCAL.NAME>>>



RE: Cutting String in the right format - Shaklaban - 10-02-2012 08:38 PM

well you can try:

args=s_circle_fire_1, s_circle_fire_2, ....s_circle_fire_10
local.fire=<argv[9]>


RE: Cutting String in the right format - admin phoenix - 10-02-2012 09:20 PM

the args include only one string like s_circle_fire_1 or s_circle_fire_2 or s_circle_fire_10
every string has to be cut down in this string "circle_fire"


RE: Cutting String in the right format - Extreme - 10-03-2012 12:05 AM

Maybe,
PHP Code:
IF STRMATCH(*CIRCLE_FIRE*,<STRING>)
 
F_CIRCLE_FIRE_BLA
ENDIF 



RE: Cutting String in the right format - Mordaunt - 10-09-2012 01:59 AM

You can't use strarg or streat to take part of a word, only part of "string" there must be gaps between the words for it to correctly pull the word you want out.
So, either do something like Extreme suggested, or modify your string if possible


RE: Cutting String in the right format - admin phoenix - 10-09-2012 10:13 PM

do I have using strarg or streat in my function? don´t see it Smile
also extreme didn´t understand me correct. that´s not what I want.
My way works fine but it is a little too much and I wonder if there is a shorter way


RE: Cutting String in the right format - Mordaunt - 10-10-2012 02:57 AM

Sorry, I misread