Home AMX User Forum AMX General Discussion

Apostrophe's in arrays?

How do you go about getting apostrophe's in an array to work?
 'Master Suite Windows',     	//69 //5
     'Gallery Stairs Windows',   	//70 //6
     'Back Bedroom Windows',  		//71 //7
     'Front Bedroom Windows',     	//72 //8
     'Corner Bedroom Windows',      	//73 //9
     "'Kid',39,'s Playrm Wndws'",  	//74 //10
     "'Nanny',39,'s Room Wndws'",       //75 //11
     'Spa/Exercise Windows',         	//76 //12
     '3rdFL Bedrooms Windows',      	//77 //13
     'Laundry Water Bug',   		//78 //14
     'AC Pits Water Level',              //79 //15
     '**'      				//80 //16
     }   

    

The above doesn't seem to work, although they work fine when not in the array.

Comments

  • ericmedleyericmedley Posts: 4,177
    " 'Welcome To Jen',$27,'s Room' " // $27 is an apostrophe

    This yields "Welcome to Jen's Room"
  • viningvining Posts: 4,368
    ericmedley wrote:
    " 'Welcome To Jen',$27,'s Room' " // $27 is an apostrophe
    That's just the same thing as using decimal 39. In a string all by itself it works fine but in the array of strings I'm using for security zones I would get compiler errors because the compiler would think I had more characters than the array was sized for and in the example shown I actually get the entire string dispalyed on the TP showing 39. In my editor is it's display as a decimal since I have my double and single quotes where they belong, so I don't get it.
  • Try this

    "'Kid''s Playrm Wndws'", //74 //10

    You can use back to back apostrophes to tell the system to print and or compile a single apostrophe.

    Hope this helps!

    Dan
  • jjamesjjames Posts: 2,908
    "'Kid''s Playrm Wndws'", //74 //10

    You can use back to back apostrophes to tell the system to print and or compile a single apostrophe.

    Hope this helps!

    Dan

    This is exactly what I do. Was about to suggest it, but ya beat me to it! :D
  • ericmedleyericmedley Posts: 4,177
    vining wrote: »
    ericmedley wrote:

    That's just the same thing as using decimal 39. In a string all by itself it works fine but in the array of strings I'm using for security zones I would get compiler errors because the compiler would think I had more characters than the array was sized for and in the example shown I actually get the entire string dispalyed on the TP showing 39. In my editor is it's display as a decimal since I have my double and single quotes where they belong, so I don't get it.

    Sorry, didn't read far enough.. :)

    I think you can put two apostrophes in the place of one and the complier knows that to mean "i want an apostrophe here please' Or you can just declare the variable and populate it in the DEFINE_START by using the dec 39 or hex $27.
  • viningvining Posts: 4,368
    Thanks guys! I knew other languages allowed that and pretty sure I've tried it with Netlinx as well but obviously what I tried was wrong so I gave up.
  • The back to back apostrophes work, and you don't need the double quotes for the string. This is what I use and it works fine:
    CHAR sZoneNamesArray[128][37] =	
      {
    	 'Jacqueline''s Office Sliding Door',					//Zone 1
    	 'Jacqueline''s Office Window',						//Zone 2
    	 'Jacqueline''s Office Motion',						//Zone 3
    	 'Conservatory Entry Door (Left)',					//Zone 4
    	 'Conservatory Entry Door (Right)'					//Zone 5
      }		
    

    --John
Sign In or Register to comment.