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.
Questions tagged [string-conversion]
377 questions
6
votes
1 answer
Report Builder 3.0: How to convert string representation of dates in mm/dd/yy format using CDate
I'm building a report using Report Builder 3.0.
The source system I'm working with has strings representing dates in the format of mm/dd/yy, but I want to show this to the end users as dd-MMM-yy instead. Using CDate on the string will give me errors…

confusedKid
- 3,231
- 6
- 30
- 49
6
votes
1 answer
To convert a ethereum_types::H256 to String in Rust
when I tried to convert ethereum_types::H256 to String by using to_string()
use ethereum_types::H256;
fn main() {
let s = H256::zero();
println!("{}", s);
}
I expect output to…

Shashi Raz
- 61
- 2
6
votes
1 answer
C++ std::stoul not throwing exception
I have a function to check if a string is a valid unsigned int:
unsigned long int getNum(std::string s, int base)
{
unsigned int n;
try
{
n = std::stoul(s, nullptr, base);
std::cout << errno << '\n';
if (errno !=…

Nirket Shivantrepadi
- 83
- 1
- 5
6
votes
1 answer
"Unrecognized token 'com': was expecting ('true', 'false' or 'null')"
I have converted this json to string to save in local database
{
"type": "file",
"id": "b665ff0b-5f7b-4991-ae88-ac5054880223",
"link": {
"href":…

konda rahul
- 141
- 1
- 1
- 11
6
votes
0 answers
std::atof or std::stof (c++11) unable to convert properly ("1.24")
I'm a little bit frustrated after I've found this strange atof/stof behavior
double bg = std::stof("1,24");
std::cerr<<"comma: "<

bartux
- 111
- 5
6
votes
2 answers
Forcing String to int Function to Consume Entire String
Given a string that should represent a number, I'd like to put it into a conversion function which would provide notification if the whole string did not convert.
For input: "12":
istringstream::operator>> outputs 12
atoi outputs 12
stoi outputs…

Jonathan Mee
- 37,899
- 23
- 129
- 288
6
votes
1 answer
Converting a string of numbers to hex and back to dec pandas python
I currently have a string of values which I retrieved after filtering through data from a csv file. ultimately I had to do some filtering of the data but I have the same numbers as a list, dataframe, or array. I just need to take the numbers in…

rsotommx
- 77
- 1
- 2
- 7
6
votes
1 answer
Python convert a string to a logic operator
For example, if I have an expression like
x=True or True
if I evaluate in the shell the result is True
print(x)
x=True
So now I want to convert a string or an input to direct to that logic expression like
x=raw_input('Please give an expression:')
I…
user3373458
6
votes
3 answers
How to convert a String from UTF8 to Latin1 in C/C++?
The question I have is quite simple, but I couldn't find a solution so far:
How can I convert a UTF8 encoded string to a latin1 encoded string in C++ without using any extra libs like libiconv?
Every example I could find so far is for latin1 to UTF8…

ashiaka
- 3,994
- 8
- 32
- 45
5
votes
2 answers
Converting russian characters from upper case to lower case in php
I'm trying to change the case of russian characters from upper to lower.
function toLower($string) {
echo strtr($string,'ЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ','ёйцукенгшщзхъфывапролджэячсмитьбю');
};
This is the function I used and the output…

Dhiraj
- 33,140
- 10
- 61
- 78
5
votes
1 answer
Check if a string is half width or full width in C#
C# application on Japanese Windows OS - Present Latin as Full-Width characters
I referred the accepted answer in the above link and is using the code below to convert Japanese string from full width to half width but it is returning the same full…

RP1
- 275
- 1
- 3
- 14
5
votes
1 answer
Convert large file to base64 with Delphi
I need to convert a file from 480mb to base64, but I can not. I always get out of memory message. Would anyone have any suggestions?
function TFormService.LoadFileToBase64(const AFileName: string): String;
var
// stream: TMemoryStream;
Encoder:…

oTTo Mostaert
- 53
- 1
- 1
- 3
5
votes
1 answer
Convert float to string and always get specific length of string?
How can I convert a float to a String and always get a resulting string of a specified length?
For example, if I have
float f = 0.023f;
and I want a 6 character string, I'd like to get 0.0230. But if I want to convert it to a 4 character string the…

Magnus
- 17,157
- 19
- 104
- 189
5
votes
1 answer
octal string to integer for open(O_CREATE) permissions
How to use an octal string from *argv[] for something like:
open("outfile",O_CREAT | O_RDWR,0777);
0777 means permission in octal numbers.
My code:
int arC = atoi(argv[optind]);
printf("argv optind %s after atoi %d\n",argv[optind],arC);
int test…

Vladimír Fencák
- 166
- 2
- 11
5
votes
4 answers
Java "100%" to number
Is there a built in routine in Java that will convert a percentage to a number for example, if the string contains 100% or 100px or 100, I want a float containing 100.
Using Float.parseInt or Float.valueOf result in an exception. I can write a…

SPlatten
- 5,334
- 11
- 57
- 128