How can I split a word to parts?

Hi all, Well I want to split a word into parts for example I have sentence a='Hello World', and I want to b='llo', How can I do such thing?

4 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 1 月 20 日
Your question is not enough clear
Giorgi
Giorgi 2015 年 1 月 20 日
well I have a sentence that contains two words for example 'Hello World', I need a function that will give me an output for example b that would contain the last three letter of the first word. P.S Thanks for your response:)
Stephen23
Stephen23 2015 年 1 月 20 日
編集済み: Stephen23 2015 年 1 月 20 日
Where do you want to split the words: at space characters, after the first n characters, the n final characters, after any doubled characters, two digits before any vowel character, or one of a million other rules that could explain your example output string?
Your description is inadequate.
Giorgi
Giorgi 2015 年 1 月 20 日
I want to split at the first space character, well anyway for any sentence I want that function's output should be equal to the last three letter of the first word for a given sentence.

サインインしてコメントする。

 採用された回答

Ilham Hardy
Ilham Hardy 2015 年 1 月 20 日

1 投票

thres = 3; %three last character of first word
a = 'Hello World';
b = strtok(a);
b = b(end-(thres-1):end);

1 件のコメント

Giorgi
Giorgi 2015 年 1 月 20 日
Thank you very much :)

サインインしてコメントする。

その他の回答 (1 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2015 年 1 月 20 日

コメント済み:

2015 年 1 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by