Covert Bool to String - NSString

Ads
 

Covert Bool to String - NSString

HI,

I was trying to cornet the BOOL value to NSString using following code:

BOOL test = TRUE;

NSString *strTest = [NSString stringWithFormat:@"%@",test];

But it is giving the runtime exception.

How to resolve this issue?

Thanks

View Answers

April 8, 2015 at 2:04 AM

Hi,

BOOL is integer value. You can use the following example:

 NSString *strTest  = (test) ? @"True" : @"False";

Hope the above code will help you.

Check more iPhone Programming tutorials at RoseIndia.net iPhone tutorial.

Thanks

Ads









Related Tutorials/Questions & Answers:
covert the following using java
covert the following using java  how to convert (for eg : 2.89) . this decimal to binary in java
Data Type: bool
Data Type: bool       This Example shows you how to use bool datatype in velocity. Methods... is used for controlling template methods and properties. #set($bool = true): Set
Advertisements
covert this code to GUI
covert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>...(){ System.out.println(name); books.display(); } } class Book { public String
covert this code to GUI
covert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>...(){ System.out.println(name); books.display(); } } class Book { public String
STRING.....
STRING.....  plzz sent me d code for counting vowels in a string... gui programme
string
string   difference detween "public static void main (String[] args) " and "public static void main (String args[])" in java but it executes both... "String args[]" can mean a "string array called args which is an array
string
string  String helloString = new String(helloArray); System.out.println(helloString); i am unable to understand this. could u plz explain
string
string  a java program using string function to input any string... ArrangeStringAlphabetically { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter string
String
characters in string?   import java.util.*; class RemoveDuplicateCharatcersFromString { public static String removeDuplicates(String s... < s.length(); i++) { String st = s.substring(i, i + 1
String
String  write down the code of remove any character from a given string without using any string function   please give me the code of remove any given character from a given string without using function
string
string  a java program to input a string and display the string...*; import java.io.*; public class FirstLetter{ public static String capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str
string
string   just i want to a program in a short form to the given string in buffered reader for example input string: Suresh Chandra Gupta output: S. C...; public class StringTest { public static void main(String [] args
string
string  java prgm to find total occurence of a given string pattern in a sentence
string
string  java prgm to find total occurence of a given string pattern in a sentence
String
String  write a program using string it should replace 'c'char to integer number as 1 in whole source
String
String  How to Convert sunnapu gopal to Sunnapu Gopal in java using String
String
String  how to print in between numbers if the question "String s = "1,2,3,4,5,6,8,-25"" out must be 1 2,3,4,5,6,7,8,9,10,upto25
string
and also displaying that contain word? Like I want to find "a" in the string... and a character. It then count the occurrence of that character in the string and display... String_Example { public static void main(String[] args
string
string  program for String reverse and replace in c,c++,java e.g.Input:10,20,hello output:hello;20;10   Hi Friend, Try the following java...(String[] args) { String array[]=new String[5]; Scanner input
string
string  a java program using string function that computes your initials from your full name and display them   Please visit the following links: http://www.roseindia.net/tutorial/java/core/printInitials.html http
string
string  a java program using string function and access modifiers to automate the insurance company which will have to manage the information about policy holders Data Members: 1)Policy No 2)Name of policy holder 3)Address 4
how to covert JPG format to Binary formart using java code..
how to covert JPG format to Binary formart using java code..  convert JPG format to Binary formart How can i convert JPG format to Binary format using java code plz help me out
How to format json String in Java
library. Then use following method to covert it to JSON String: String json...How to format json String in Java  Hi, How to format json String... { public static void main(String[] args) { Map<String, String>
How to format json String in Java
library. Then use following method to covert it to JSON String: String json...How to format json String in Java  Hi, How to format json String... { public static void main(String[] args) { Map<String, String>
(ii) String and String Buffer Class
(ii) String and String Buffer Class  difference between String and String Buffer Class
(ii) String and String Buffer Class
String and String Buffer Class  differences between : String and String Buffer Class
(ii) String and String Buffer Class
String and String Buffer Class  difference between String and String... between String and StringBuffer 1) String object is immutable whereas StringBuffer objects are mutable. 2) String objects are constants
String Ques
String Ques  what is difference between String str="abc"; and String str=new String("abc");   Hello Friend, Differences: 1)String str=new string("abc") creates two objects, one in heap memory and one in string
string program
string program  wap to find single occurrence of given string in java without using any predefined method
String progrm
String progrm  wap to count character of given string in java without using any method
String conversion
String conversion  I want to convert a string of mix cases(lower and upper case) to vice versa. ex. HellO should be printed to hELLo. the string comes from user using datainputstream. Also sending individual chars of string

Ads