B4A Library String Functions

Discussion in 'Additional libraries, classes and official updates' started by margret, Jul 22, 2011.

  1. margret

    margret Well-Known Member Licensed User

    Thanks for the update, I will fix these. I hope that's the worst I did. I'd rather them be in the tips and not the code but there maybe some there also :eek:.
     
  2. margret

    margret Well-Known Member Licensed User

    Post #1 is updated. If you downloaded version 1.05 before this post, you may wish to download it again. Some corrections were made to the tooltips.
     
  3. stanks

    stanks Active Member Licensed User

    i was talking about your 1st thread here. check description for SplitGetWord func
     
  4. chrjak

    chrjak Active Member Licensed User

    nice work BUT is this lib the reason why i have a read data permission in my app?
    Edit: I just saw: Yes it is.
    But why needs it to write on the external storage?
    How to disable this? How to explain that a string reformer uses this permission...!?
    I use only split
     
    Last edited: Mar 31, 2014
  5. klaus

    klaus Expert Licensed User

  6. chrjak

    chrjak Active Member Licensed User

    does it work with a list, too?
     
  7. klaus

    klaus Expert Licensed User

    No, it returns a String array.
     
  8. chrjak

    chrjak Active Member Licensed User

    but you can convert it!?
    (for i = 0 to string().indexes
    list.add(string(i))
    next)
    Edit: It worked. Thanks Klaus
     
    Last edited: Mar 31, 2014
  9. klaus

    klaus Expert Licensed User

    Shouldn't it be:
    Code:
    For i = 0 to string().Length - 1
        
    list.add(string(i))
    Next
     
    spairo likes this.
  10. chrjak

    chrjak Active Member Licensed User

    yes :)
    This was only the manifest for the code
    Ragards
     
  11. margret

    margret Well-Known Member Licensed User

    The new library 1.05 has new commands(SaveData & GetData) to write and read data. This is why the permission is needed. If you use one of the previous versions, they do not require these permissions.
     
  12. NJDude

    NJDude Expert Licensed User

    If you are sure you're not going to need that permission then remove it, add this line to your manifest using the manifest editor:
    Code:
    RemovePermission(android.permission.WRITE_EXTERNAL_STORAGE)
     
    thedesolatesoul likes this.
  13. howt

    howt Member Licensed User

    Hi Margret,

    I have a problem with the InString-Function:
    STRA = "abc"

    I = fs.Instr (STRA, "abc")
    I = 0? why? I would still be 1 or?

    next example:
    I = fs.Instr (STRA, "xyz")
    I = 0, that is correct!

    the other functions are great!

    Walter
     
  14. margret

    margret Well-Known Member Licensed User

    Elements in Android start at position 0. In your example:

    a is at position 0
    b is at position 1
    c is at position 2

    So why is the problem?

    If you issue: Instring(STRA, "bc"), is will return a 1.
     
    Theera likes this.
  15. howt

    howt Member Licensed User

    not found = 0
    Found at the first position = 0
    How can I distinguish that?
    In Visual basic is found the first position = 1!?
     
  16. margret

    margret Well-Known Member Licensed User

    Not found = -1, anything over -1 = found. I just ran this test code:

    Code:
    Log(jstr.InString("Mr. Jim Hall","Jim"))
    Log(jstr.InString("Mr. Jim Hall","Bill"))
    Log(jstr.InString("Mr. Jim Hall","Hall"))
    Log(jstr.InString("Mr. Jim Hall","Mr"))
    Log Results:
    Even the arrays in B4A start at position 0 as the first element. The List items do as well.
     
    Last edited: Apr 3, 2014
  17. howt

    howt Member Licensed User

    hallo Margret,
    so it works! thank you

    Walter
     
  18. chrjak

    chrjak Active Member Licensed User

    Wow these are great News!
    Thanks!
     
  19. sultan87

    sultan87 Active Member Licensed User

    Hello Margret
    I want to use sf.MidExtract function to retrieve a value between two "
    how to
    best regards
     
  20. sultan87

    sultan87 Active Member Licensed User

    Hello Margret
    I want to replace a character with another in a string
    such as replacing the "K" by an "R" in the string
    [Deal "N: KJ.Q63.AK743.542 AQT862.4.QJ9.T96 54.AKJT7.862.AKJ 973.9852.T5.Q873"]
    I tried with sf.stuff, but it does not replace a character
    there no one INSTR function as in VB
    Best regards
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice