Search Results

Search found 2 results on 1 pages for 'yadollah'.

Page 1/1 | 1 

  • How do I seperate Punctuations in a sentence with a space between each phrase and punctuation in C++

    - by Yadollah
    I want to write a program in c++ that get a sentence and insert a space between each word and punctuation in it! in perl this is done with this expression: sed -e "s/,\([^0-9]\)/ , \1/g" -e "s/\.\([^0-9]\)/ . \1/g" -e 's/\.[ ]*$/ ./g' -e "s/\'/ \' /g" -e 's/?/ ?/g' -e 's/\`\`/ `` /g' -e "s/\' \'/''/g" -e 's/(/ ( /g' -e 's/)/ ) /g' -e 's/ \. \([^$]\)/. \1/g' -e "s/\' s/\'s/g" -e "s/\"\([^\"]*\)\"/\" \1 \"/g" $1 | sed -e "s/\"\([^\"]*\)\"/\`\`\1''/g" But I don't khow how i should do this in c++! for example: should convert a "The question now: Can he act more like hard-charging Teddy Roosevelt." must be converted to "The question now : Can he act more like hard-charging Teddy Roosevelt ." So a punctuation such as '-' or for example a '.' in "No." should not spacing in a sentence, but other punctuation that don't rely on a word or a phrase should be spaced.

    Read the article

  • How do I insert format str and don't remove the matched regular expression in input string in boost:

    - by Yadollah
    I want to put space between punctuations and other words in a sentence. But boost::regex_replace() replaces the punctuation with space, and I want to keep a punctuation in the sentence! for example in this code the output should be "Hello . hi , " regex e1("[.,]"); std::basic_string<char> str = "Hello.hi,"; std::basic_string<char> fmt = " "; cout<<regex_replace(str, e1, fmt)<<endl; Can you help me?

    Read the article

1