Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Add whitespaces to a string

Add whitespaces to a string

Put your problem here if it does not fit any of the other categories.

Add whitespaces to a string

Postby solo » Mon Nov 05, 2012 11:31 pm

Hi all,

I want to add whitespaces to a string whenever the following is discovered:
+ - * / ^

So if my string is:
Code: Select all
editTextInputData = "(1+2)*(3/4)-(5+6)";


It should be:
Code: Select all
editTextInputData = "( 1 + 2 ) * ( 3 / 4 ) - ( 5 + 6 )";


This is what i got :
Code: Select all
    /*- add Spaces To Equation ----------------------------------------- */
    public void addSpaces (){
      editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\+", " + ");
      editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\-", " - ");
      editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\*", " * ");
      editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\/", " / ");

      editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\(", " ( ");
      editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\)", " ) ");

    } 
~ Asking if computers can think is like asking if submarines can swim.
User avatar
solo
Junior Developer
Junior Developer
 
Posts: 22
Joined: Fri Mar 25, 2011 9:51 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], MSNbot Media and 13 guests