Loading ...
Sorry, an error occurred while loading the content.

12546Re: [Clip] Re: splitting a string on a character

Expand Messages
  • Don Passenger
    Oct 3, 2004
    • 0 Attachment
      Well done Hugo. Much easier than where I was going ... which was this
      direction:

      ;test rounddown (from earlier question)
      ^!Set %test%=^$Calc(floor(6.53+1))$

      ^!Prompt ^%test%
      ;works


      ;test time split (this question)
      ^!Set %test2%=22:15
      ^!Prompt ^%test2%

      ;get index of :
      ^!Set %test3%=^$StrPos(":";"^%test2%";False)$
      ^!Prompt ^%test3%
      ;works

      ;get front part of string
      ^!Set %test4%=^$StrCopy("^%test2%";0;^$Calc(^%test3%-1)$)$
      ^!Prompt ^%test4%
      ;works

      ;get last part of string
      ^!Set %test5%=^$StrCopyRight("^%test2%";^$Calc(^%test3%+1)$)$
      ^!Prompt ^%test5%
      ;MISERABLE FAILURE

      ^!Continue stop here

      Think I'll use your method. Oddly, I don't yet have my question let
      alone any other answers, but your answer arrived fine. Odd how some
      things just seem to get lost for a while. Big system I guess over at
      yahoogroups.

      Hugo Paulissen wrote:

      >
      > --- In ntb-clips@yahoogroups.com, Don Passenger <dpasseng@i...> wrote:
      >
      >>the next part of my puzzle is splitting a string on a character
      >>in my case I am working with minutes:seconds (note : in the middle)
      >>I want to split the string on the : but there may be either one or
      >
      > two
      >
      >>minute characters
      >>
      >
      >
      > Don,
      >
      > You could look into all string functions or you could simply use an
      > array and do it like this...
      >
      > ^!SetListDelimiter :
      > ^!SetArray %time%=10:45
      > ^!Info ^%time1%
      > ^!Info ^%time2%
      >
      > Hugo
    • Show all 4 messages in this topic