News:

Function Finder  Find all the functions within source code files

Main Menu

The " character

Started by Makeii Runoru, February 19, 2009, 10:42:40 PM

Previous topic - Next topic

Makeii Runoru

I've hit a snag in development. Often with other languages, if I need to include a character such as " in a string, I can simply type in \". But this is not the case. I'm creating my own bitmap font and I need to figure out how to place the " in a string.
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.

kevin

#1
 In BASIC (every edition I can think of), you use the ASCII code. IE.  chr$(34).  

 Btw, you know that PB has bitmap font ability built in ?




Makeii Runoru

I do. I found the ASCII code for it too. I also found the ASCII codes for all other symbols. If you'd like you can use this small reference?

// 33 = !
// 34 = "
// 35 = #
// 36 = $
// 37 = %
// 38 = &
// 39 = '
// 40 = (
// 41 = )
// 42 = *
// 43 = +
// 44 = ,
// 45 = -
// 46 = .
// 47 = /

// 48 - 57 = 0-9

// 58 = :
// 59 = ;
// 60 = <
// 61 = =
// 62 = >
// 63 = ?
// 64 = @

// 65 - 90 = A-Z

// 91 = [
// 92 = \
// 93 = ]
// 94 = ^
// 95 = _
// 96 = `

// 97 - 122 = a-z

// 123 = {
// 124 = |
// 125 = }
// 126 = ~

// 146 = ???

// 161 - 255 = irregular symbols


(sorry, was writing them in PB)

Now, if I use the #input library and want to input a " character into the string, will this cause bugs?
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.

kevin


  No, it's unrelated.  The only reason why the " chr is even interesting, is because Basic compilers uses this token to explicitly denote the start and end of constant string within the program code.   It has no importance at runtime at all.


Ie.


#include "input"


Print "Hello World"    ;( Hello World is a constant string..  you can't alter it)

T$=chr$(34)+"Hello World"+chr$(34)    ; build the string "Hello World" (including quotes)

print  t$

result$=StaticInput(">")
print result$
flushkeys

Sync
waitkey



Makeii Runoru

I see. This makes more sense now. Thanks :P
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.