Qbasicnews.com

Full Version: explode() and implode()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Quote:red_marvin: remember to add back in the separator Wink

What do you mean?

something like:

Code:
FUNCTION implode(string_array(),separator)
  DIM st$=""
  FOR n = LBOUND(string_array()) TO UBOUND(string_array())
    st$=st$+string_array(n)
    IF n<>UBOUND(string_array$) THEN st$=st$+chr$(separator)   '<<==
  NEXT
  implode=st$
END FUNCTION

...or just the fact that I forgot to return the string value
-> implode=str$

?

Well I modified for both...
i made a duplicate of perls SPLIT function which seems to work exactly like you're challenging us. It's at the code post. There are some bugs in that version though, which i've recently fixed.
I'm a lazy sod. Post it here if you wanna win Tongue

edit: sterling's entry:

still does exploding if I use two spaces for seperating " " instead of one " ", when the gaps in the string are only one space wide.

But it looks good so far Smile
Pages: 1 2