Announcement

Collapse
No announcement yet.

String Things....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • String Things....

    Supposing you want to "Add" to a string but more than once, how can you specify the "start at position" in multiple instances ie: String = aabb***d want it to be aa-bb-cc-dd etc.
    the best I could come up with was to re-evaluate the new string over and over..gotta be simpler than that eh?

  • #2
    Re: String Things....

    STRING > INSERT

    use character of -1 to specify the last character in the string as the starting point.

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment


    • #3
      Re: String Things....

      huh? that still will only get you a single insert, I did this It works but i think it is a sloppy way of doing it, especially if it was a really long string
      - <IR_ACTIONS_LIST>
      - <Action name="Insert">
      <Type>61</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      - <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage />
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel />
      </ErrorHandling>
      <Variable>%NewString%</Variable>
      <Source>%MACInfo%</Source>
      <StartAt>2</StartAt>
      <TextToInsert>-</TextToInsert>
      </Action>
      - <Action name="Insert">
      <Type>61</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      - <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage />
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel />
      </ErrorHandling>
      <Variable>%NewString%</Variable>
      <Source>%NewString%</Source>
      <StartAt>5</StartAt>
      <TextToInsert>-</TextToInsert>
      </Action>
      - <Action name="Insert">
      <Type>61</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      - <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage />
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel />
      </ErrorHandling>
      <Variable>%NewString%</Variable>
      <Source>%NewString%</Source>
      <StartAt>8</StartAt>
      <TextToInsert>-</TextToInsert>
      </Action>
      - <Action name="Insert">
      <Type>61</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      - <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage />
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel />
      </ErrorHandling>
      <Variable>%NewString%</Variable>
      <Source>%NewString%</Source>
      <StartAt>11</StartAt>
      <TextToInsert>-</TextToInsert>
      </Action>
      - <Action name="Insert">
      <Type>61</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      - <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage />
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel />
      </ErrorHandling>
      <Variable>%NewString%</Variable>
      <Source>%NewString%</Source>
      <StartAt>14</StartAt>
      <TextToInsert>-</TextToInsert>
      </Action>
      </IR_ACTIONS_LIST>

      Comment


      • #4
        Re: String Things....

        The positions where you want to add characters to the string, are they at even intervals like what you have descirbed in your example? When you first evaluate the string are you able to determine where you want to insert all new instances? The additions to the new string, are they all the same length (i.e., one character each)?

        The reason I ask is can you do something simple like this:

        %abcs% = "aabb***d"
        %length%=String.GetLength ("%abcs%")
        %insertpos% = "%length%"
        <font color=blue>WHILE (%insertpos% > 2)</font color=blue>
        %insertpos% = Evluate (%insertpos% -2)
        %abcs% = String.Insert ("%abcs%","-",%insertpos%)
        <font color=blue>END WHILE</font color=blue>
        %Result% = Dialog.MessageBox ("Title", "%abcs%",Ok,Question)

        This takes the string in %abcs% and finds the length, then copies the variable to a new variable %insertpos%. Then we enter a while loop that will run while the variable %insertpos% is greater than 2. While running it will subtract 2 from the variable %insertpos%, insert a "-" (without quotes) at that position then do it all again until the variable %insertpos% is reater than 2. it will then display a dialog box with the value of the variable which will be aa-bb-cc-dd.

        This works if the insertions are at the same positions inside the string. If this doesn't work, let us know we will give it another *****.
        TJ-Tigger
        "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
        "Draco dormiens nunquam titillandus."
        Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

        Comment


        • #5
          Re: String Things....

          If it is the MAC Address you are interested you can change the first lin in my post above to
          %abcs% = System.GetInformation("MAC Address")

          Here is the code for you to cut and paste.

          <IR_ACTIONS_LIST>
          <Action name="Get Information">
          <Type>140</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%abcs%</Variable>
          <Property>9</Property>
          </Action>
          <Action name="Get Length">
          <Type>145</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%Length%</Variable>
          <SourceString>%abcs%</SourceString>
          </Action>
          <Action name="Set Value">
          <Type>6</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%insertpos%</Variable>
          <Value>%Length%</Value>
          <Evaluate>0</Evaluate>
          </Action>
          <Action name="WHILE">
          <Type>204</Type>
          <Function>1</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Condition>%insertpos% &amp;gt; 2</Condition>
          </Action>
          <Action name="Set Value">
          <Type>6</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%insertpos%</Variable>
          <Value>%insertpos% -2</Value>
          <Evaluate>1</Evaluate>
          </Action>
          <Action name="Insert">
          <Type>61</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%abcs%</Variable>
          <Source>%abcs%</Source>
          <StartAt>%Insertpos%</StartAt>
          <TextToInsert>-</TextToInsert>
          </Action>
          <Action name="END WHILE">
          <Type>205</Type>
          <Function>1</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          </Action>
          <Action name="Message Box">
          <Type>5</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <DialogTitle>Title</DialogTitle>
          <DialogMessage>%abcs%</DialogMessage>
          <Icon>3</Icon>
          <Variable>%Result%</Variable>
          <DialogType>0</DialogType>
          <DefaultButton>0</DefaultButton>
          </Action>
          </IR_ACTIONS_LIST>
          TJ-Tigger
          "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
          "Draco dormiens nunquam titillandus."
          Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

          Comment


          • #6
            Re: String Things....

            lmao! you actually answered my question....there is no "simple" way ..It is for the Ethernet MAC address , 10 digit
            I think I leave it the way I got it now works ok, I just thought you could enter in multiple positions in the same "Add to string" I modified my last set to re evaluate the %newstring% over again every time the "-" was added, then the last insert to store the %result% back into the original variable.what the hay..it works

            Comment


            • #7
              Re: String Things....

              Hmmm... I guess I just don't understand the issue because I still don't see how STRING > INSERT fails to do that, you can stack actions you know, it's not like you can only use each action once... Seems simple to me, oh well, as long as you have it figured out...

              Corey Milner
              Creative Director, Indigo Rose Software

              Comment

              Working...
              X