Другая опция состоит в том, чтобы использовать htlatex, чтобы создать веб-страницу из ЛАТЕКСНЫХ источников, затем использовать ссылки для преобразования в простой текст. Я использовал командную строку
links -dump -no-numbering -no-references input.html > output.txt
в прошлом, которое дало довольно хороший результат. Это будет, конечно, скорее соответствовать представлению представленного HTML, чем исходного PDF, таким образом возможно, не точно, что Вы хотите.
STRTOK , и операция с индексом должна помочь:
str = 'johndoe@hotmail.com';
[name,address] = strtok(str,'@');
address = address(2:end);
Или последняя строка также может быть:
address(1) = '';
Вы можете использовать strread :
str = 'johndoe@hotmail.com';
[a b] = strread(str, '%s %s', 'delimiter','@')
a =
'johndoe'
b =
'hotmail.com'
For "easiest",
>> email = 'johndoe@hotmail.com'
email =
johndoe@hotmail.com
>> email == '@'
ans =
Columns 1 through 13
0 0 0 0 0 0 0 1 0 0 0 0 0
Columns 14 through 19
0 0 0 0 0 0
>> at = find(email == '@')
at =
8
>> email(1:at-1)
ans =
johndoe
>> email(at+1:end)
ans =
hotmail.com
It would be slightly more complicated if you were looking for something with more than one character, or you weren't sure if there was exactly one @, and in that case MATLAB has a lot of functions for searching through text, including regular expressions (see doc regexp
).
TEXTSCAN тоже работает.
str = 'johndoe@hotmail.com';
parts = textscan(str, '%s %s', 'Delimiter', '@');
возвращает массив ячеек, где parts {1} - это 'johndoe', а parts {2} - 'hotmail.com'.