Sponsored Content
Full Discussion: Converting integer to String
Top Forums Shell Programming and Scripting Converting integer to String Post 302202730 by ROOZ on Thursday 5th of June 2008 01:28:20 PM
Old 06-05-2008
Converting integer to String

Hi everyone,
I would like to know how to convert an integer to a string. for instance if i=1 i would like to creat a variable called constant1. i want to do this in a for loop so for each value of i, i create a new variable such as constant2, constant3,... and so on.

for i in 1 2 3
do
commands to create the variables

done

thank you Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command for converting string to integer

Hi ... I am trying to calculate the time needed for a command to execute.. but the resulting value is getting as string.. so i am not able to use "expr " command.. please help me to convert the value to integer so that i can proceed with my script.. Regards esham (1 Reply)
Discussion started by: esham
1 Replies

2. Shell Programming and Scripting

Converting a decimal into integer

Hi all, I'm trying to convert a decimal number into an integer number; I'm doing this: n=`echo |awk '{ print "'"$mem"'"*10}'` where the variable mem is equal to 3.7 I'd like to obtain 37, but the expression above gives me 30. Help please!!!! thx a lot (4 Replies)
Discussion started by: idro
4 Replies

3. UNIX for Dummies Questions & Answers

Converting a String variable into Integer

Hi, I am passing a variable to a unix function. However when I try to assign the value to another variable like typeset -i I_CACHE_VAL=$2 Is this because of String to Integer conversion? I get an error. Please help me with thsi. Thanks (2 Replies)
Discussion started by: neeto
2 Replies

4. Shell Programming and Scripting

Converting decimal to integer

The shell mentioned below will show a warning if the page takes more than 6 seconds to load. The problem is that myduration variable is not an integer. How do I convert it to integer? myduration=$(curl http://192.168.50.1/mantisbt/view.php?id=1 -w %{time_total}) > /dev/null ; ] && echo... (3 Replies)
Discussion started by: shantanuo
3 Replies

5. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

6. Shell Programming and Scripting

Converting Month into Integer

okay so i run an openssl command to get the date of an expired script. Doing so gives me this: enddate=Jun 26 23:59:59 2012 GMT Then i cut everything out and just leave the month which is "Jun" Now the next part of my script is to tell the user if the the certificate is expired or not... (6 Replies)
Discussion started by: shade917
6 Replies

7. Shell Programming and Scripting

Converting date +%j into integer

Dear community, i got a problem to get "date +%j" as the right value. Today is the 10th day of the year. #./script.sh 2 #!/bin/bash/ Var1=$(date +%j) Var2=$1 let result=$Var1+$Var2 echo $Var1 plus $Var2 equals $result The output of the script is: 010 plus 2 equals 10... (9 Replies)
Discussion started by: OskarHF
9 Replies

8. Shell Programming and Scripting

Converting string to integer

I have a function that is supposed to check for user processes and wait for 0 count before exiting the function. I am sure I have more than one issue in my code, but the stumbling block right now is that I am trying to convert the value of my variable from a string to integer. process_count... (10 Replies)
Discussion started by: MIA651
10 Replies

9. Shell Programming and Scripting

Converting String To Integer/Float (weird case)

Hi guys, I'm new here. I have a problem at work. One of our scripts was eventually having a bug and only detected recently. Here's the issue and background: Bash Script which calls AWK script Awk script returns a string as per below (example):var1='00000-123'So, when we convert it, the... (18 Replies)
Discussion started by: sekfarok
18 Replies

10. Shell Programming and Scripting

Converting time format as Integer to seconds

Hello, How can we convert date like format 20181004171050 in seconds ? I can able to convert till date but failing for HHMMSS. date -d "20181004" "+%s" output as 1538596800 . But when i add hhmmss it is failing date -d "20181004172000" "+%s" result Invalid date Kindly guide. Regards (16 Replies)
Discussion started by: sadique.manzar
16 Replies
UCONVERTER(3)								 1							     UCONVERTER(3)

The UConverter class

INTRODUCTION
CLASS SYNOPSIS
UConverter UConverter Constants o const integer$UConverter::REASON_UNASSIGNED0 o const integer$UConverter::REASON_ILLEGAL1 o const integer$UConverter::REASON_IRREGULAR2 o const integer$UConverter::REASON_RESET3 o const integer$UConverter::REASON_CLOSE4 o const integer$UConverter::REASON_CLONE5 o const integer$UConverter::UNSUPPORTED_CONVERTER-1 o const integer$UConverter::SBCS0 o const integer$UConverter::DBCS1 o const integer$UConverter::MBCS2 o const integer$UConverter::LATIN_13 o const integer$UConverter::UTF84 o const integer$UConverter::UTF16_BigEndian5 o const integer$UConverter::UTF16_LittleEndian6 o const integer$UConverter::UTF32_BigEndian7 o const integer$UConverter::UTF32_LittleEndian8 o const integer$UConverter::EBCDIC_STATEFUL9 o const integer$UConverter::ISO_202210 o const integer$UConverter::LMBCS_111 o const integer$UConverter::LMBCS_212 o const integer$UConverter::LMBCS_313 o const integer$UConverter::LMBCS_414 o const integer$UConverter::LMBCS_515 o const integer$UConverter::LMBCS_616 o const integer$UConverter::LMBCS_817 o const integer$UConverter::LMBCS_1118 o const integer$UConverter::LMBCS_1619 o const integer$UConverter::LMBCS_1720 o const integer$UConverter::LMBCS_1821 o const integer$UConverter::LMBCS_1922 o const integer$UConverter::LMBCS_LAST22 o const integer$UConverter::HZ23 o const integer$UConverter::SCSU24 o const integer$UConverter::ISCII25 o const integer$UConverter::US_ASCII26 o const integer$UConverter::UTF727 o const integer$UConverter::BOCU128 o const integer$UConverter::UTF1629 o const integer$UConverter::UTF3230 o const integer$UConverter::CESU831 o const integer$UConverter::IMAP_MAILBOX32 Methods o public UConverter::__construct ([string $destination_encoding], [string $source_encoding]) o public string UConverter::convert (string $str, [bool $reverse]) o public mixed UConverter::fromUCallback (integer $reason, string $source, string $codePoint, integer &$error) o publicstatic array UConverter::getAliases ([string $name]) o publicstatic array UConverter::getAvailable (void ) o public string UConverter::getDestinationEncoding (void ) o public integer UConverter::getDestinationType (void ) o public integer UConverter::getErrorCode (void ) o public string UConverter::getErrorMessage (void ) o public string UConverter::getSourceEncoding (void ) o public integer UConverter::getSourceType (void ) o publicstatic array UConverter::getStandards (void ) o public string UConverter::getSubstChars (void ) o publicstatic string UConverter::reasonText ([integer $reason]) o public void UConverter::setDestinationEncoding (string $encoding) o public void UConverter::setSourceEncoding (string $encoding) o public void UConverter::setSubstChars (string $chars) o public mixed UConverter::toUCallback (integer $reason, string $source, string $codeUnits, integer &$error) o publicstatic string UConverter::transcode (string $str, string $toEncoding, string $fromEncoding, [array $options]) PREDEFINED CONSTANTS
o UConverter::REASON_UNASSIGNED - o UConverter::REASON_ILLEGAL - o UConverter::REASON_IRREGULAR - o UConverter::REASON_RESET - o UConverter::REASON_CLOSE - o UConverter::REASON_CLONE - o UConverter::UNSUPPORTED_CONVERTER - o UConverter::SBCS - o UConverter::DBCS - o UConverter::MBCS - o UConverter::LATIN_1 - o UConverter::UTF8 - o UConverter::UTF16_BigEndian - o UConverter::UTF16_LittleEndian - o UConverter::UTF32_BigEndian - o UConverter::UTF32_LittleEndian - o UConverter::EBCDIC_STATEFUL - o UConverter::ISO_2022 - o UConverter::LMBCS_1 - o UConverter::LMBCS_2 - o UConverter::LMBCS_3 - o UConverter::LMBCS_4 - o UConverter::LMBCS_5 - o UConverter::LMBCS_6 - o UConverter::LMBCS_8 - o UConverter::LMBCS_11 - o UConverter::LMBCS_16 - o UConverter::LMBCS_17 - o UConverter::LMBCS_18 - o UConverter::LMBCS_19 - o UConverter::LMBCS_LAST - o UConverter::HZ - o UConverter::SCSU - o UConverter::ISCII - o UConverter::US_ASCII - o UConverter::UTF7 - o UConverter::BOCU1 - o UConverter::UTF16 - o UConverter::UTF32 - o UConverter::CESU8 - o UConverter::IMAP_MAILBOX - PHP Documentation Group UCONVERTER(3)
All times are GMT -4. The time now is 04:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy