map read key problem

Cor

Active Member
Licensed User
Longtime User
If key begins with space then space is automatically stripped off

see key 024

Now i have to put dummy char at begin and strip it off when reading key

Is this a feature of map?


Code: Copy
dim lickmap as map
dim str1 as string

bluesv1.dat contains
024=    0   0 2p0       4   4   2p058
025=-   0   0 2p0       4   4   2p058

lickMap=File.readmap(File.dirassets,"bluesv1.dat")

str1=lickMap.Get("024")

tabCanvas.DrawText(str1,18dip,48,tabFont,20,Colors.Blue,"LEFT")
 
I don't see this behavior.
Check this code for example which works as expected:
Code: Copy
    Dim s As String
    s = " 123"
    Dim m As Map
    m.Initialize
    m.Put(s,s)
    File.WriteMap(File.DirRootExternal, "1.txt", m)
    Log(m)
    m = File.ReadMap(File.DirRootExternal, "1.txt")
    Dim s2 As String
    s2 = m.Get(" 123")
    Log(s2.Length)
    Log(m)
 
Upvote 0
Don't create txt with map.put

Just create with editor and save it as utf-8
then use only readmap

attached is a utf-8 text file
 

Attachments

Last edited:
Upvote 0
after done several tests, map is unuseable for loading tab notation style

\ = slide
and space are stripped off

I will find for another solution to read the text files

like below

Code: Copy
02u=              |2
021=                                
022=                                  
023=                      0   0     
024=/    0   0 2p0      4   4   2p0
025= 0h3   3       3 /5            
026=\3p2                                    
02d=     d u   d   u     u d u d
 
Upvote 0
Hi Cor,

Not sure if this will help, but you could use an arbitrary character at the beginning of each row and strip it out on reading. Also you would have to change the keys of the non strings to sort in the correct order if that's important. I attach an example.

steve
 

Attachments

Last edited:
Upvote 0
Hello Steve,

Yes, i use that now,

I use now . at the beginning and replace after reading the map
e.g s to /

and do a replace in my code

Code: Copy
02u=.             |2
021=.                               
022=.                                     
023=.                     0   0     
024=.    01  0 2p0      4   4   2p0*
025=.0h3   3       3 /5            
026=.s3p2                                    
02d=.    d u   d   u     u d u d
 
Upvote 0
Back
Top