Posts Tagged ‘convert’

How to convert NSString to BOOL, Int, Float, Double, Long

  • 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];

, , , ,

No Comments


How to:Convert String to Integer


Example:

  1.  
  2. NSString *strValue = @"10";
  3. NSInteger intValue = [strValue intValue];


, ,

1 Comment


How to check if a varchar (string) column can be converted to numeric

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

, , ,

No Comments



SetPageWidth