Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: sgsims on August 30, 2016, 10:54:57 AM

Title: STRINSERT - Argument out of Range (ST132)
Post by: sgsims on August 30, 2016, 10:54:57 AM
I am using the STRINSERT Inst to append an ASCII Control character to the end of a String in SS0.  Since the length of the string in SS0 will vary I thought I could specify an Offset value of 50 which is longer than the longest string SS0, (34) ASCII characters,  would see but still leave room for the appended Control character in the string.  When I execute the STRINSERT inst the control character is appended how I expected/hoped but I receive a ST132 Warning.

Should I worry about that warning and//or is there a better way of adding a control character to the end of an ASCII string.

Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: plcnut on August 30, 2016, 11:35:46 AM
STRPRINT with the "append to string" checked.
Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: sgsims on August 30, 2016, 11:47:44 AM
Works like a charm!  Thanks PLCnut...Guess I have to get my "String" on with all these string instructions:)
Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: plcnut on August 30, 2016, 11:52:26 AM
You're welcome. STRINSERT will also work if you set the index to String.length+1
Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: sgsims on August 30, 2016, 11:57:23 AM
Very cool also
Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: sgsims on August 30, 2016, 01:02:11 PM
Just curious the ss0.length + 1 isn't accepted into the "Starting at Offset" field.  Although it looks like all I need is the ss0.length in that field to get the control character appended on the end.
Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: plcnut on August 30, 2016, 01:20:54 PM
You would have to use a MATH for the SS0.length+1
Title: Re: STRINSERT - Argument out of Range (ST132)
Post by: franji1 on August 30, 2016, 04:15:53 PM
Just curious the ss0.length + 1 isn't accepted into the "Starting at Offset" field.  Although it looks like all I need is the ss0.length in that field to get the control character appended on the end.

As with nearly all things Do-more, the block IDs and string character offset/index positions are 0-based, not 1 based.

Hence, the first character of SS0 is at index 0, not 1.  So the "Starting at Offset" parameter of SS0.Length is definitely how you would "append".