Convert number to letter

Hi there
I am trying to find a way to convert a number to a character
for a game I am working on. Currently the users score can be sent
to a friend via a query string e.g.
www.mygame.com/game?usersscore=111.11
This is not ideal as all the user needs to do is alter the
query string to automaitcally change their score. So what I want to
do is disguise the score as a series of random letters. e.g. 123.12
= abc.ab
Then when the flash reads in the query string abc.ab it
converts it back to the score of 123.12
I have looked at converting the score to hexidecimal to
disguise it but can you convert a decimal number with a point in it
e.g.22.5 or would it only except whole numbers?
Any help on this would be much appreciated
Trevor

quote:
Originally posted by:
clbeech
That code works great on its own but when I try and put it in
my game it doesn't seem to work properly. Basically my send to a
friend section appears on the last frame of the game. At this point
i give the user the url using the encode function.
I have added your code and have got the game encoding the the
score to the letters (Great so far)
However if you are starting a game the decode function needs
to be on the first frame of the flash movie to show the user their
friends score (e.g. so it can work out that bbcc is 1122 for
example) based on the query string. However the decode function is
never passed the encode result as the flash movie doesn't get to
the last frame:
decode(coded); //send to decode the test string
So I need to be able to encode on the last frame (which is
done) and then decode on the first frame.
I tried this but its not outputting anything:
varchallengerscore = "ab"; //I am trying to pass the value of
this variable to the decode function
decode(varchallengerscore)
function decode(str) {
var decoded:String='';
for(var i=0; i<str.length; i++) {
if(i==str.length-2) {
decoded+='.';
for(var j=0; j<char.length; j++) {
if(char[j]==str.charAt(i)) {
decoded+=j;
break;
trace(decoded); //test output
any ideas? Also I hope this all makes sense to you and I am
describing the situation ok. So far you guys have been a massive
help so thanks.

Similar Messages

  • Convert number to letter of alphabet?

    Hi,
    Is there a LabWindows function for converting a number to an alphabet equivalent?
    I was trying something like this...
    char getLetterOfAlphabetByNum(int number){
        //test if alpha
        if(isalpha (number)==0)
            DebugPrintf ("Error converting number to letter. Non-alphabetic.");
        else{
            //take decimal and convert to ascii
            statusReturned=Fmt (&letter, "%s<%d", number);
            if(statusReturned<0)
                DebugPrintf ("Error converting number to letter!\n");
            DebugPrintf ("tempString = %s\n", letter);
        DebugPrintf ("%d --> %s\n",number,letter);
    return letter;
    Thanks!
    Solved!
    Go to Solution.

    It seems to me that you could simplify your code this way:
    //number of alphabet to letter
    char getLetterOfAlphabetByNum (int number)
        number += 64;
        //test if alpha
        if (!isalpha (number)) {              
            DebugPrintf ("Non-alphabetic.\n");
            return 0;
        return (char)number;
    I excluded the test for printable characters as is it overcome by test for alphabetic.
    Also, be warned that passing numbers from 33 to 58 returns lowercase letters.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to convert number datatype to raw datatype for use in data warehouse?

    I am picking up the work of another grad student who assembled the initial data for a data warehouse, mapped out a dimensional dw and then created then initial fact and dimension tables. I am using oracle enterprise 11gR2. The student was new to oracle and used datatypes of NUMBER (without a length - defaulting to number(38) for dimension keys. The dw has 1 fact table and about 20 dimension tables at this point.
    Before refining the dw further, I have to translate all these dimension tables and convert all columns of Number and Number(n) (where n=1-38) to raw datatype with a length. The goal is to compact the size of the dw database significantly. With only a few exceptions every number column is a dimension key or attribute.
    The entire dw db is now sitting in a datapump dmp file. this has to be imported to the db instance and then somehow converted so all occurrences of a number datatype into raw datatypes. BTW, there are other datatypes present such as varchar2 and date.
    I discovered that datapump cannot convert number to raw in an import or export, so the instance tables once loaded using impdp will be the starting point.
    I found there is a utl_raw package delivered with oracle to facilitate using the raw datatype. This has a numbertoraw function. Never used it and am unsure how to incorporate this in the table conversions. I also hope to use OWB capabilities at some point but I have never used it and only know that it has a lot of analytical capabilities. As a preliminary step I have done partial imports and determined the max length of every number column so I can alter the present schema number columns tp be an apporpriate max length for each column in each table.
    Right now I am not sure what the next step is. Any suggestions for the data conversion steps would be appreciated.

    Hi there,
    The post about "Convert Numbers" might help in your case. You might also interested in "Anydata cast" or transformations.
    Thanks,

  • Problem in converting number to character

    Hi All,
    In my report there is number field called <?LINE_TOT_AMOUNT?>. In the next line i want to display that amount in words. I tried using
    <?xdofx:to_char(LINE_TOT_AMOUNT)?>
    but the output is same as the <?LINE_TOT_AMOUNT?>. Can any one help in solving this?

    look at TO_CHAR (number)
    if LINE_TOT_AMOUNT is number then to_char(LINE_TOT_AMOUNT) in string
    it's not display that amount in words
    it's only format row
    if you wnat to convert number to words
    plz see Re: Conversion of number to word

  • How can I create a random number and letter in a text field...

    Hi All,
    I am using application express. I want to get a random number and letter for a text field but not sure how to do this. Say I have a licence form and I want to get the licence number automatically when user wants to create a new licence and it needs to be unique. The format I am looking for is - HQ2631 something like this.
    I am thinking I have to create a trigger but not sure how to go about this....
    advanced thanks,
    Tajuddin

    Something to play with:
    Your method can generate 26 * 26 * 10000 different licence_ids
    Generating one million ids takes 20 seconds but produces between 70000 and 80000 duplicates and is rapidly getting worse (if that is something over 7%, doubling the ids generated that grows to something under 30%)
    Just see if you can live with that.
    select sum(collisions) all_duplicates,count(*) distinct_duplicates,max(collisions) max_multiple
      from (select licence_id,count(*) - 1 collisions
              from (select DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999)) licence_id
                      from dual
                     connect by level <= :to_generate
             group by licence_id
             having count(*) > 1
           )Regards
    Etbin

  • Function module for converting number to exponential???

    Hi All
      please tell me Function module for converting number to exponential.
    Deepak

    try:
    REPORT Zconvertf.
    parameters p1 type p decimals 2 default '4711.99'.
    data f1 type f.
    move p1 to f1.
    write: / p1, f1.
    hope that helps
    Andreas

  • I want to convert number to hours in oracle 10 like this.

    Dear All
    Some can help me
    I want to convert below MS-SQL query in oracle 10g. please help me.
    for eg:
    Select numasdate,
    Cast(numasdate / 60 as Varchar) + ' hours ' +
    Cast(numasdate % 60 as Varchar) + ' minutes'
    as [TotalHoursAndMinutes]
    From
    #SampleTable
    Output:
    9436 157 hours 16 minutes
    537 8 hours 57 minutes
    9323 155 hours 23 minutes
    12525 208 hours 45 minutes
    Edited by: Parwez on Jan 1, 2013 5:33 AM

    I want to convert number to hours in oracle 10g like this.
    537 8 hours 57 minutes
    9436 157 hours 16 minutes
    12525 208 hours 45 minutesTry this...
    Ranit>> with xx as(
      2      SELECT 537 num from dual UNION ALL
      3       SELECT 9436 num from dual UNION ALL
      4       SELECT 12525 num from dual
      5  )
      6  select
      7       num,
      8       FLOOR(num/60)||' hrs' as "hrs",
      9       MOD(num,60)||' minutes' as "minutes",
    10       FLOOR(num/60)||' hrs  '||MOD(num,60)||' minutes' as "Hours.Mins"
    11  from xx;
           NUM hrs                                          minutes                                          Hours.Mins                                                                                                        
           537 8 hrs                                        57 minutes                                       8 hrs  57 minutes                                                                                                 
          9436 157 hrs                                      16 minutes                                       157 hrs  16 minutes                                                                                               
         12525 208 hrs                                      45 minutes                                       208 hrs  45 minutes                                                                                                Edited by: ranit B on Jan 1, 2013 6:51 PM
    --- Hey John... I just did it and saw your hint now !!!

  • Asset Sub Number with Letter

    Dear Expert
    Is it possible to define asset sub number using letter? e.g 1000000001 A001
    Thanks and Regards,
    YL

    Hi YL,
    The sub number field is four numeric character field. Hence you cannot use alphabets.
    However in Tcode OAOA (Asset class), if you tick the checkbox "EXTERNAL SUB NUMBER", you can use your own sub number for the asset.
    Please let me know if it helps.
    Ranjani

  • Convert number of dayes per year to data

    Please i need help in Convert number of dayes to date
    I have ID's like id
    FT*09025*0000000001 date=20090125
    FT*01171*0000000002 date=20100620
    so should convert first five number after FT to date
    example *09025*
    09 map to 2009
    025 number of dayes per year map to 25 jan
    example *01171*
    01 map to 2010
    171 number of dayes per year map to 20 jun
    (jan+feb+mar+apr+may)=(31+28+31+30+31)=151
    171-151=20 for the next month
    Please need help so will added filter to informatica map with date
    Edited by: user8929623 on Jul 4, 2010 7:04 PM

    Well, I do not follow why when 09 maps into 2009, 01 maps into 2010, not into 2001. Assuming it should be 2001, use YYDDD format:
    SQL> with t as (
      2             select 'FT*09025*0000000001' id from dual union all
      3             select 'FT*01171*0000000002' from dual
      4            )
      5  select  to_date(substr(id,4,5),'yyddd') dt
      6    from  t
      7  /
    DT
    20090125
    20010620
    SQL> SY.

  • How to convert number to string in java

    hi how can i convert number to string in java
    something like
    public void Discription(Number ownerName){
    String.valueOf(ownerName);Edited by: adf009 on 2013/04/08 7:14 PM

    Yet another way of doing it is: ownerName.toString().
    If you are working in and IDE such as Netbeans or Eclipse, type a period after the object name. Wait a second or so. Eclipse/Netbeans Intellisense will show you a list of functions that object provides that you can choose from. toString() is one of them.

  • How can I stop Pages converting the second letter in a postcode into lowercase?

    Ever since I had a new upgrade to Pages last year it converts the second letter of a postcode to lowercase even though I have the caps lock on.  How can I stop it doing this?  eg SW15 1QZ becomes Sw15 1QZ.

    Try:
    Menu > Pages > Preferences > Auto-Correction > uncheck Fix Capitilization
    or anything else there that might apply.
    Peter

  • How to judge whether the chars contain only number and letter

    how to judge whether the chars contain only number and letter, for example :
    'AEs4386' is valid , but '‘´‘¼ew78' is not
    thanks for your help !

    Hi,
    try the following:
    data: l_test(36) type c.
    concatenate sy-abcde '0123456789' into l_test.
    l_test contains all letters all numbers now
    translate YourVariable to upper case.
    YourVariable contains only upper case letters
    check YourVariable co l_test. " or use if instead of check
    YourVariable contains only letters or numbers
    regards
    Siggi

  • Convert number to alphabet

    hi
    i need help in converting number to alphabet
    for example 4 to D, 2 to B, etc
    thank you for helping
    best regards
    andors

    private String Number2String(int number, bool isCaps)
        Char c
    = (Char)((isCaps ? 64 : 96) + number);
        return c.ToString();
    No point in doing - 1.
    If you want 0 to be A then start at 65 for caps, 97 for lower.
    Edit:
    After some messing around, I've come up with the perfect method:
    public static string numberToAlpha(long number, bool isLower = false)
    string returnVal = "";
    char c = isLower ? 'a' : 'A';
    while (number >= 0)
    returnVal = (char)(c + number % 26) + returnVal;
    number /= 26;
    number--;
    return returnVal;

  • Convert number to simplified chinese number (daxie)

    I need to print simplified chinese number (daxie). Do SAP have standard function module or BAPI to convert number into simplified chinese number (daxie). for example:
    1001 = &#22777;&#20191;&#38646;&#22777;&#20803;
    111 = &#22777;&#20336;&#22777;&#25342;&#22777;&#20803;
    Thanks.

    Hi,
      Use FM :SPELL_AMOUNT

  • How to convert lower case letter to upper case letters

    hai all,
    How to convert lower case letter to upper case letters??
    Thanks & Regards,
    suresh

    Hi Suresh,
    Include ALL_CAPITAL in the RSKC Tx.
    Also try this code in your Transfer rule,
    TRANSLATE TRAN_STRUCTURE-(Info Object Name) TO UPPER CASE.
    RESULT = TRAN_STRUCTURE-(Info Object Name)
    Hope this solves................

Maybe you are looking for

  • Dynamic structure handling in PI

    Hi All, Here is the detailed description of the issue I am facing in PI for dynamically handling receiver structure change. Sender : GIS (Through Web Service) Receiver: SAP ( ABAP Proxy ) Interface : Synch Equipment and Functional Location will be se

  • How to save the Increment  update to the PDF on the web

    By now I use PDDocSaveWithParams method to save file,but this method is used to local,not on the web. I think there are some methode in SDK to save(or send)  the Incremental update to the server. But i don't know which is,so if there is please tell m

  • ISO file format not compatible

    I have a video which was downloaded form a Video cam a little while ago. It was captured with another program which converted it to an iso file. All attempts to open it in Premier Pro and Encore have failed so far. The error message simply states "Fi

  • Polling for files using SAP workflow

    Hi all. First of all, I am not sure if this is the correct forum for this question.. Please let me know if it needs to be moved. I need to know if it is possible to use SAP Workflow to keep looking (polling) for files in a certain directory? I know I

  • Downloaded fireworks in chinese. how to change to english?

    downloaded fireworks tiral in chinese, how to change to english?