View unanswered posts | View active topics It is currently Tue Feb 09, 2016 7:54 am

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
how to convert a text character to a figure or vice versa
Author Message
Guru

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
how to convert a text character to a figure or vice versa
hi,
if you have a text letter like "a", "A", or "Z": how can you get the ASCII integer value of this?
e.g.
ASCII("a")=97,
ASCII("A")=65,
ASCII("Z")=90,
ASCII("1")=49,

and how can you encode an integer value to a text character?
chr(97)="a"
a.s.o.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)

Sat Sep 06, 2008 8:50 am
Rookie

Joined: Thu Jun 26, 2008 11:27 am
Posts: 22
Location: Johannesburg, South Africa
Re: how to convert a text character to a figure or vice versa
Hi

This seems to work:
 Code:   string str = "A";   int t = (int)str;   nxtDisplayTextLine(1,"%d", t);      char ch = 42;   nxtDisplayTextLine(2,(string)ch);

Sat Sep 06, 2008 12:17 pm
Guru

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Re: how to convert a text character to a figure or vice versa
thx a lot,
that's easier than I thought ...

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)

Sat Sep 06, 2008 12:27 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 3 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    2014 Robotics Academy Summer of Learning    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.