Posts Tagged ‘convert’
How to convert NSString to BOOL, Int, Float, Double, Long
Posted by: admin in iOS, NSString, Objective C, String on June 25th, 2011
- Converting NSString to Bool
[NSString_Instance boolValue];
- Converting NSString to Integer
[NSString_Instance intValue];
or
[NSString_Instance integerValue];
- Converting NSString to Float
[NSString_Instance floatValue];
- Converting NSString to Double
[NSString_Instance doubleValue];
- Converting NSString to Long
[NSString_Instance longLongValue];
How to:Convert String to Integer
Posted by: admin in Objective C, String on May 11th, 2011
Example:
-
-
NSString *strValue = @"10";
-
NSInteger intValue = [strValue intValue];
How to check if a varchar (string) column can be converted to numeric
Posted by: admin in Database, MS SQL Server, SQL Server 2008 on May 19th, 2010
Use the ISNUMERIC function of the sql server to this job.
To check all records of that particular column if it contains a string or can be converted to numeric use the script below.
select
case when sum(
case when COLUMN_NAME is null then 1
when ltrim(rtrim(COLUMN_NAME)) = ” then 1
else isnumeric(COLUMN_NAME)
end) = count(*) then 1 else 0 end x from TABLENAME
You can find more info here