- #1

- 1,196

- 0

for example v='Helllllloooooo'

or

v='Helo'

I was able to append empty characters onto anyone dimensional vector that the user can enter so that way the total length of the vector is a multiple of 8 characters of long or not add any empty characters onto the vector if it's length is already an exact multiple of 8

I'm struggling with segmenting this vector's characters to a vector that has as many rows as needed that each have exactly 8 column's

for example

function('Hello World!')

and the function returns

g=Hello Wo

rld!

were it adds blank characters so that there is actually blank spaces after the exclamation mark to make the second row 8 characters in length.

I'm all set on making the input to the function be a multiple of 8 characters in length regardless of what string the user inputs. I'm struggling with segmenting this new message like in the example above because the message can be any multiple of 8... I tried using a four loop and just taking off multiples of 8 and setting them to a new row of another vector but am struggling because of the fact that the message can be any length

basically how do I turn any string who's length is a multiple of 8 (i figured out how to append blank spaces so that it would always be a multiple of 8) and segment it into something like this

function('Hello World!')

and the function returns

g=Hello Wo

rld!

I hope that makes sense

thanks for any help

if it's not clear what I'm trying to do please let me know.

I tried taking any string such as

V='helloooooooooo '

and using

reshape(V,2,8)

but it returns something like this

hlooooo

elooo

which is not what i wanted...