Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 19th, 2005, 11:54 AM
sal sal is offline
Friend of Wrox
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default Return ASCII values for a given string

Wuw can i do a loop on a string to return the ASCII values of the string

"This is a Test"

as the ASCII values? 84, 104, 104, etc.

I am trying to move the following SQL Server function to c#.

DECLARE @position int, @string char(8)

SET @position = 1
SET @string = 'This is a Test'
WHILE @position <= DATALENGTH(@string)
   SELECT ASCII(SUBSTRING(@string, @position, 1))
         SET @position = @position + 1

I can do it in VB6, but I am not sure how to do this in C#. I have researched a ton and I am still at a loss.


Reply With Quote
  #2 (permalink)  
Old May 19th, 2005, 03:59 PM
Friend of Wrox
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

            string s="abc";
            byte[] result=System.Text.Encoding.ASCII.GetBytes(s);
            foreach(byte b in result)

software student.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DoCmd.RunSQL to return values jscully Access VBA 10 August 21st, 2017 12:58 PM
Converting a set of string to its ascii value... rittwick Beginning VB 6 4 April 2nd, 2007 10:46 AM
how to return string value with quotes (single or tllcll BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 November 10th, 2005 01:57 PM
Multiple Return Values Colonel Angus SQL Server 2000 2 June 2nd, 2004 09:11 AM
Return String is Different kochoo Classic ASP Components 2 October 19th, 2003 05:41 AM

All times are GMT -4. The time now is 10:53 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.