[sedonadev] how to use strings

68 views
Skip to first unread message

keith bradley

unread,
May 7, 2017, 3:19:30 PM5/7/17
to sedo...@googlegroups.com
Good day all!

I have yet to use a property slot which is a string.

I have:

  @config
  @asStr
  property
  Buf(13) myString



So when I try to access an element:

** ** Called to see if myString is null / empty. ** bool myString_null() { for (int i=0; i<13; ++i) { if (myString[i] != 0) return false } return true }


... I get:

Cannot use [] operator on 'sys::Buf'


Murat Egrikavuk

unread,
May 8, 2017, 12:58:32 AM5/8/17
to sedo...@googlegroups.com

myString.get(i) would work (see http://www.sedonadev.org/doc/sys/Buf.html).

On the other hand, only the first byte needs to be zero for the string to be treated as empty.

You should also be able to use:
if ( myString.toStr().equals("") )
  or
if ( myString.toStr().length == 0 ) 
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.
To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.



--
Murat Egrikavuk
Ontrol A.S.

keith bradley

unread,
May 11, 2017, 4:01:41 PM5/11/17
to sedo...@googlegroups.com
Thanks Murat!

On Sun, May 7, 2017 at 11:58 PM, Murat Egrikavuk <murat.e...@ontrol.com.tr> wrote:

myString.get(i) would work (see http://www.sedonadev.org/doc/sys/Buf.html).

On the other hand, only the first byte needs to be zero for the string to be treated as empty.

You should also be able to use:
if ( myString.toStr().equals("") )
  or
if ( myString.toStr().length == 0 ) 



On Sun, 07 May 2017 22:19:28 +0300, keith bradley <kmbra...@gmail.com> wrote:

Good day all!

I have yet to use a property slot which is a string.

I have:

  @config
  @asStr
  property
  Buf(13) myString



So when I try to access an element:

** ** Called to see if myString is null / empty. ** bool myString_null() { for (int i=0; i<13; ++i) { if (myString[i] != 0) return false } return true }


... I get:

Cannot use [] operator on 'sys::Buf'


--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.



--
Murat Egrikavuk
Ontrol A.S.

--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages