Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline bricemik  
#1 Posted : 02 June 2021 11:06:43(UTC)
bricemik

Rank: Newbie

Groups: Registered
Joined: 02/06/2021(UTC)
Posts: 5
France

Was thanked: 1 time(s) in 1 post(s)
Hi,
I trie to split string every underscore :
B_net="PM1_to_MM1_gth_vpx_p[0]"
with function :
strsplit(B_net,"_" )=mat("PM1_to_MM1_gth_vpx_p[0]",1,1)

I want to extract here "PM1" and "MM1" with
el(strsplit(B_net,"\005F\" ),1)
el(strsplit(B_net,"\005F\" ),3)


But, the underscore is seen as UTF-16 encoding :
strsplit(B_net,"\005F\" )

Thanks for your help

Regards

Bricemik


Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Andrey Ivashov  
#2 Posted : 02 June 2021 14:35:52(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Hello. Please use the latest stable SMath Studio version.
Offline bricemik  
#3 Posted : 02 June 2021 17:55:13(UTC)
bricemik

Rank: Newbie

Groups: Registered
Joined: 02/06/2021(UTC)
Posts: 5
France

Was thanked: 1 time(s) in 1 post(s)
Hello,

Thank you for your quick feedback
I would like to take this opportunity to thank you for your tool that I use for a few years ago.


Concerning the trouble, I use the lasted stable Smath Studio version : 0.99 build 7822

I import string from a csv file.
The strplit don't recognize the underscore.
However, the findstr does

If I use the strrep function to replace the underscore by the underscore in the string, the strplit recognize the underscore.

Please see below the extract :

text=mat("MM1_To_PM1_presence",1,1)
b_net:el(text,1)="MM1_To_PM1_presence"
strsplit(b_net,"\005F\" )=mat("MM1_To_PM1_presence",1,1)
findstr(b_net,"\005F\" )=mat(4,7,11,3,1)
b_net:strrep(b_net,"\005F\","\005F\" )="MM1\005F\To\005F\PM1\005F\presence"
strsplit(b_net,"\005F\" )=mat("MM1","To","PM1","presence",4,1)
findstr(b_net,"\005F\" )=mat(4,7,11,3,1)

I have this trouble since the lasted stable version.

With the previous stable version, 0.99 build 7610, the split function is ok :
text=mat("MM1_To_PM1_presence",1,1)
b_net:el(text,1)="MM1_To_PM1_presence"
strsplit(b_net,"_" )=mat("MM1","To","PM1","presence",4,1)
findstr(b_net,"\005F\" )=mat(4,7,11,3,1)
b_net:strrep(b_net,"\005F\","\005F\" )="MM1\005F\To\005F\PM1\005F\presence"
strsplit(b_net,"\005F\" )=mat("MM1","To","PM1","presence",4,1)
findstr(b_net,"\005F\" )=mat(4,7,11,3,1)

Please to not take into consideration the space before the parenthesis.
If not, there is a smiley "Wink.

Thanks

Bricemik









Offline Andrey Ivashov  
#4 Posted : 02 June 2021 19:55:57(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Please could you attach your worksheet? I cannot reproduce this issue.
Offline bricemik  
#5 Posted : 02 June 2021 21:33:26(UTC)
bricemik

Rank: Newbie

Groups: Registered
Joined: 02/06/2021(UTC)
Posts: 5
France

Was thanked: 1 time(s) in 1 post(s)
Please find attached the files.

Regards

test_strsplit_input.txt (1kb) downloaded 10 time(s). test_strsplit.sm (9kb) downloaded 11 time(s).

thanks 1 user thanked bricemik for this useful post.
on 02/06/2021(UTC)
Offline Andrey Ivashov  
#6 Posted : 02 June 2021 22:29:26(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Thank you! Reproduced.
Will fix.
Offline overlord  
#7 Posted : 02 June 2021 22:32:06(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,126
Turkey

Was thanked: 507 time(s) in 338 post(s)
Originally Posted by: Andrey Ivashov Go to Quoted Post
Thank you! Reproduced.
Will fix.

Maybe windows release has this issue.
Linux load and split it correctly.

Regards

2021-06-02_22-31.png
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.