Stringtheory Split - RemoveQuotes

Hi

Is it meant that “RemoveQuotes” doesn’t work when there is a space before or after the separating character, or at the beginning/end of the string?
My datasets can come with or without spaces

st.SetValue('<January>,<February>')
st.Split(',','<','>',TRUE)
Result:
January
February

st.SetValue(' <January> , <February> ')
st.Split(',','<','>',TRUE)
Result:
<January>
<February>

Regards Niels

Hi Niels

you need this:

st.Split(‘,’,’ <<-<<‘,’> ->‘,TRUE,’-')

what that is specifying is that you have TWO sets of quotes, either with or without spaces. Perhaps I should use <32> for space to make it clearer:

st.Split(‘,’,‘<32><<-<<’,‘><32>->’,TRUE,‘-’)

note that you normally “double up” < to be << except when you are specifying character decimal values.

and also note I am using - as the separator between the two sets of quotes.

note also that sometimes you have to do tricks to get a trailing space to work on quotes due to the way ST clips the quotes - so in this case I put the case with the trailing space FIRST so that it works perfectly.

cheers

Geoff R

Hello again Niels

I probably should have added that if you find having multiple quotes specified too confusing or find a situation that cannot be readily handled, you could always fall back to manually removing the quotes using st.trim

st.split(',')  ! split on comma
loop x = 1 to st.records()
  lne.setValue(st.getLine(x))
  lne.trim('<32><<>')
  st.setLine(x,lne)
end

as they say, many ways to skin a cat.

cheers

Geoff R