Questions tagged [string-conversion]

String conversion is the act of converting data to and from character strings. It is a special case of type conversion and commonly used in programming to combine multiple data types into a string or when validating/storing user input.

377 questions
-2
votes
1 answer

can't remove @4N_McrAirport

so i just have to remove the words starting with "@". i need to convert this from @sam_mie_J @4N_McrAirport @airfrance I can't describe my feelings. to this I can't describe my feelings. and i have tried this at first mm="@sam_mie_J @4N_McrAirport…
-2
votes
2 answers

Converting a string of letters to a string of numbers in PHP

I'm trying to write a PHP function that converts a string of letters to a corresponding string of numbers. For example, the input abc should return 123 and the input wxyz should return 23242526. I have done some research and found that the ord…
Samir
  • 15
  • 7
-2
votes
2 answers

How to add an ASCII value of a byte to an integer in golang?

I'd like to get a byte[] variables' asic value added to an integer. For example, I fisrt read all input in a byte[] buffer. And then I get out a number string "123" in it. And then I can assign it to an integer by ('1' - '0')*100 + ('2' - '0')*10 +…
younis
  • 147
  • 2
  • 6
-2
votes
3 answers

String.replaceAll(string,string) method gives unexpexted output

I have some amounts as input like: Rs1 , INR10,954.00 , INR 45000 , INR 25000.70 , Rs.25000 , Rs.1,000 , Rs. 14000 these are the input formats I'm using String getRuppee="Rs1"; // this string can not get the format and gives wrong…
Sagar Thakarar
  • 261
  • 3
  • 20
-2
votes
2 answers

How do i make it so it accepts both command line args

I seem to be messing something up as when i run the code it fails out at my first if statement with the output being "must have 2 cmd line args". Im trying to figure out where I'm messing up and unfortunately I'm at a desktop that wont allow me to…
-2
votes
3 answers

How do I convert my string?

I have a string that can be up to 9 characters long including an optional decimal point but all the others will be numbers. It could be "123456789" or "12.345678", for example. What variable type should I convert it to so that I can use it in…
Toby Smith
  • 1,505
  • 2
  • 15
  • 24
-2
votes
1 answer

C++: Decimal to Roman Numeral conversion

I know how to do this and have made a program that does so in the past, however it never incorporated the special cases of roman numerals (e.g. IV = 4). Integrating that into a functional program in a minimalistic way is my main problem. Is there a…
T145
  • 1,415
  • 1
  • 13
  • 33
-2
votes
1 answer

why does the toString method shows error?

This is my code. I have overridden the toString() method. So, when an object e is being printed the overridden method must be called. But I don't see the method being called. public static void main(String[] args) { try { …
-2
votes
2 answers

How to parse date/time from a string in C++

How to convert string with template "%d.%m.%Y %H:%M:%S" (for example, 28.05.2013 17:42:00) to boost::posix_time::ptime or something similar? The following is my non-working code. boost::posix_time::ptime stringToDateTime(const std::string &text) { …
Loom
  • 9,768
  • 22
  • 60
  • 112
-3
votes
2 answers

Convert two timestamps to time elapses in Python

I'm trying to get the time elapsed between two string timestamps in my Python code. Example: Time Started: "2022-01-07 14:30" Time Ended: "2022-01-07 15:45" I want the answer to return as an int in number of minutes. So, in this example it would be…
-3
votes
2 answers

Why is ToString() not working on a type String , and what is the work around?

I'm reading rows from excel into a model , and excel returns the input such as "10%" or "20%" as "0.1" ,"0.2" string . What is the best way to convert that string into a string such as "20%" , "10%" and to avoid unnecessary conversions, in order not…
-3
votes
1 answer

Strange Behavior In C#: Parsing Strings To Doubles Bug

Update: Here is a link to a project that fails at be even if it's explicitly a double in VS 2015 CE .NET 4.6. https://dl.dropboxusercontent.com/u/20941617/Scratchpad.zip Ok I know how to replicate it. When it breaks on the the explicit operator…
XSapien
  • 152
  • 2
  • 11
-3
votes
2 answers

Why does my floating point value have an `E` character when I convert it to a string?

txtDebugLog.Invoke(new MethodInvoker(delegate() { fps.Frame(); ggg = fps.GetFPS(); txtDebugLog.Text = String.Format("{0}\r\n{1}", ggg, txtDebugLog.Text); }) txtDebugLog is a TextBox. Using a breakpoint i see on ggg in this example it's…
-3
votes
1 answer

NumberFormatException error; string to int conversion

I tried converting a string "A1+B2" to an integer because A1 and A2 are both integers but it doesn't evaluate the sum. Any idea how I could solve this problem?
-4
votes
3 answers

Convert string to char in python

Is there a possibility (e.g. a built-in function) to convert a string to a char in python? For example, if I assign a value to the variable p1=100 and then have the string "p1", is it possible to assign the value of p1 to a new variable t like…
Paul Rousseau
  • 571
  • 2
  • 7
  • 21
1 2 3
25
26