Tutorial ThreeStrings&Sorting
Tutorial Three Strings & Sorting
Character CodesCharacter codes are mappings between numbers andthe symbols which make up a particular alphabet.ASCll: American Standard Code for InformationInterchangeAsinglebytecharactercode128 characters are specifiedThehighest-orderbitisleftaszeroUnicodeTwo bytespercharacterNatively supportedbyJava
Character Codes ⚫ Character codes are mappings between numbers and the symbols which make up a particular alphabet. ⚫ ASCII: American Standard Code for Information Interchange ⚫ A single byte character code ⚫ 128 characters are specified ⚫ The highest-order bit is left as zero ⚫ Unicode ⚫ Two bytes per character ⚫ Natively supported by Java
ASCll CodeDecHx Oct HtmlChr[Dec HxOctHtml ChrlDec HxOct Htmi ChrDec Hx Oct Char10064;P96603220040 Space64.4060140`0000MUL(null)1101&65;1001SOH3321041!:!65元41A9761 141a:aof heading)(start3422042""b2102B:B200266429862142bSTX(start of text)3CC30033523043#:#6743103&67;9963143cETX(end of text)4Dd4 004EOT36240446#366844104#68:10064144&100;(end of transmission)55005ENQ3725045%:6945105EE10165145e:e(enquiry)F#102:f66006ACK3826046&:7046106F10266146(acknowledge)G77007BEL3927047'7147107G:10367147g:g(bell)Hh:h88010BS4028050#40;7248110H:10468150(backspace)9#105:19011TAB4129051):7349111I:工10569151(horizontal tab)10A012LF422A052*:大744A112JJ1066A152j:1(NL line feed, new line)&107:K11B 013VT432B053+:+754B113K:K1076B153(vertical tab)112C014FF442C054,764C114L:L1086C154l:(NP form feed,new page)13D015CR452D055#45;774D115M:M1096D155m:m(carriage return)14E016SO462E056#46784E116N:N1106E156nn(shift out)15F017SI472F057/:794F117O:01116F157o:0(shift in)/1610020DLE4830060#48:08050120#80P11270160p:p(data link escape)1711021DCI49310616#49:18151121Q:0q:(device control l)1137116191812022DC25032062#50:28252122#82:Rr:r(devicecontrol 2)114721621913DC35133063338353123#83:Ss:3023(devicecontrol 3)1157316352340644:48454124#84;Tt:t20 14 024 DC411674164(devicecontrol 4)21155335065#53:58555125#85:Uuu025NAK11775165(negative acknowledge)5436066668656126VV6#118;V2216026SYN11876166(symchronous idle)5537067#55:787127WT6#119;W2317027ETB5711977167(end of trans. block)5638070#56:8130#88:X弄120:X24 18 030CAN885812078170(cancel)EM5739071#57:913189:4&弃121;Y2519031895912179171(end of medium)90132Z:Z&弄122:Z261A032SUB583A072:::5A1227A172(substitute)9113391:&弃123;27 1B033ESC593B073;::5B1237B1731(escape)192134\:G#124;28 1C034FS603C074<:<5C1247C174(file separator)613D075=:93]&弃125;291D035GS5D1351257D175(group separator)94.5E^301E036RS623E076#62:>1361267E176&126:(record separator)&弃127:DEL31 1F037US633F077#63:?955F137󨏭F177(unit separator)Source:www.LookupTables.com
ASCII Code
Some Properties about ASCll。Uppercase letters,lowercase letters,andnumerical digits appear sequentiallyTo iterate through all the lowercase lettersfor(ch = ‘a'; ch <= ‘z'; ch++)is character ch uppercase?(ch >= ‘A') && (ch<= ‘Z") Convert uppercase character ch to lowercasech-(A'-‘a)
Some Properties about ASCII ⚫ Uppercase letters, lowercase letters, and numerical digits appear sequentially. ⚫ To iterate through all the lowercase letters ⚫ for(ch = ‘a’; ch <= ‘z’; ch++) ⚫ is character ch uppercase? ⚫ (ch >= ‘A’) && (ch <= ‘Z’) ⚫ Convert uppercase character ch to lowercase ⚫ ch – (‘A’ – ‘a’)
Strings Strings are sequences of characters Different programming languages may havedifferent representations!C/C++:Null-terminated array: the string ends with null character10'.Enough array must be allocated to hold the largestpossible string (plus the null)Java:Array plus length
Strings ⚫ Strings are sequences of characters. ⚫ Different programming languages may have different representations! ⚫ C/C++: ⚫ Null-terminated array: the string ends with null character ‘\0’. ⚫ Enough array must be allocated to hold the largest possible string (plus the null). ⚫ Java: ⚫ Array plus length