It's easy to subset a character vector:
>> c = 'hello world';
>> c(1:5)
ans =
'hello'
But that doesn't work for strings:
>> s = "hello world";
>> s(1:5)
Index exceeds the number of array elements (1).
How do I subset a string?
It's easy to subset a character vector:
>> c = 'hello world';
>> c(1:5)
ans =
'hello'
But that doesn't work for strings:
>> s = "hello world";
>> s(1:5)
Index exceeds the number of array elements (1).
How do I subset a string?
You can use the extractBetween function:
>> s = "hello world";
>> extractBetween(s, 1, 5)
ans =
"hello"