web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)
Answered

Ascii Value of a string

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  I have a string like INV-1819-0001. I want to get Ascii value of each character of a string

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Divesh Profile Picture
    327 on at

    Hi

    You can use the below function to get the Ascii Value of each character from the string.

    LOCAL GetASCIIValue(pText : Text)
    //Variables
    //Name	  DataType
    //lAscii	Integer
    //li	    Integer
    
    FOR li := 1 TO STRLEN(pText) DO BEGIN
      lAscii := pText[li];
      MESSAGE('Character %1 Ascii Value %2',pText[li],lAscii);
    END;
    
    LOCAL GetASCIIValue2(pText : Text)
    //Variables
    //Name	  DataType
    //lChar	  Char
    //lAscii	Integer
    //li	    Integer
    
    FOR li := 1 TO STRLEN(pText) DO BEGIN
      lChar := pText[li];
      lAscii := lChar;
      MESSAGE('Character %1 Ascii Value %2',pText[li],lAscii);
    END;

    GetASCIIValue('INV-1819-0001');
    GetASCIIValue('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    GetASCIIValue('0123456789');
    GetASCIIValue2('INV-1819-0001');
    GetASCIIValue2('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    GetASCIIValue2('0123456789');

    Hope this helps. Thanks

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     I have below code and how i should convert sAscii to Ascii value.

    array1[1] := "No.";

    FOR i := 1 TO STRLEN(array1[1]) DO BEGIN
    sAscii := COPYSTR(array1[1], i,1);

    END;

    Thanks

  • Verified answer
    Divesh Profile Picture
    327 on at

    Since you have not provided more details on your reply, I have assumed the Data Type of the Array1 is Integer, below is the code for updating the Ascii value to Array1.

    lText := "No.";
    FOR li := 1 TO STRLEN(lText) DO BEGIN
      Array1[li]  := lText[li];
    END;
  • jsshivalik Profile Picture
    3,099 on at

    Hi Divesh

     i am able to get Ascii values . For eg i have text = INV . I have got values 73,78,86. Now i want to save these values in one string

    like 73&78&86&

    Thanks

  • Divesh Profile Picture
    327 on at

    So where you want to use the ascii value ?

  • jsshivalik Profile Picture
    3,099 on at

    Hi

      I want to save the values in a string and then pass to parameter

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
TAHER_El_Mehdi Profile Picture

TAHER_El_Mehdi 2

#1
sliderxb Profile Picture

sliderxb 2

#1
broberts Profile Picture

broberts 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans