Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: jwbaker3 on February 05, 2024, 12:01:39 PM

Title: Strings
Post by: jwbaker3 on February 05, 2024, 12:01:39 PM
I am using a reader to stream in the data sometimes there are leading zeros, the stream in has them from the reader but when I do a string copy it drops the leading zero's. Is there any way to keep the leading zero's on a copy?

Thanks,
JW
Title: Re: Strings
Post by: franji1 on February 05, 2024, 12:30:37 PM
REMOVED
Title: Re: Strings
Post by: franji1 on February 05, 2024, 12:35:35 PM
Sorry, I misread your request.

So in the original String element it is something like "0001234"?

Then you do a STRCOPY (no conversions, no parsing, nothing)
and in the destination you are getting (as a string "1234"?

If not, please provide details exactly what you get in the STREAMIN instruction, and what code you are processing the string with, and what you get in the final STRING.
Title: Re: Strings
Post by: jwbaker3 on February 05, 2024, 02:02:16 PM
I went back and looked at the QR codes they were scanning in and some of them did not have the leading zero's, so I think it is a non automation problem. I have noticed when I convert a string to a integer if there is a leading zero it drops the zero from the number. I have a work around for this, so not a big deal.

Thanks,
JW
Title: Re: Strings
Post by: franji1 on February 05, 2024, 02:16:16 PM
I have noticed when I convert a string to a integer if there is a leading zero it drops the zero from the number. I have a work around for this, so not a big deal.

That's what I would expect.  When converting a string "123" to its integer value, it's 123 - that's whether the source string is "123" or "0123" or "00000123"