mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
I have a &bvar that contains unicode/utf-8 text, is there a way to get the length of text; that is the number of characters without having to loop over its entirety examining chunks of text

Last edited by FroggieDaFrog; 24/05/21 02:09 PM.

I am SReject
My Stuff
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Assuming it's valid UTF8 already:

//var -sp %a t $+ $chr(233) $+ st $+ $chr(10004) $+ $chr(32) , %b $utfencode(%a) , %c $len(%b)

result: * Set %c to 9

Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
The issue I'm having is that the data is in a &bvar and its larger than mIRC's LLL


I am SReject
My Stuff
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
In this case you might need to use $bvar(&binvar,N,M).text where each subsequent N is M+1, and each M is calculated by jumping ahead $maxlenl bytes then finding the next byte value that's not in the 128-191 range.


Link Copied to Clipboard