Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get length of a string in Octave?

Tags:

octave

How do I get the length of a string in Octave?

I looked here and here and here for some equivalent to PHP's strlen(), but I did not find anything.

like image 298
moondog Avatar asked Feb 02 '26 23:02

moondog


1 Answers

As the first link you posted explains, strings are just matrices, so you can use the regular matrix operations, for instance length.

> x = "teststring";
> length(x)
ans = 10
like image 179
mtrw Avatar answered Feb 04 '26 15:02

mtrw