.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Need to calculate number Bytes consumed by string

Posted By: Asha.MP     Posted Date: November 10, 2010    Points:2   Category :ASP.Net
Hi...

I want to know is there any function to find the bytecount of the string.

Like
dim s1 as string="asha"
dim s2 as string="????"

here i need to find the bytecout of s1 and s2.

Responses
Author: Jean Paul             
Posted Date: November 10, 2010     Points: 5   

Use string.Length

Eg: s1.Length

(If unicode it would be 2 bytes per character)

Jean Paul http://jeanpaulva.com/
Author: Asha.MP             
Posted Date: November 10, 2010     Points: 5   

Hi..

If there are two string with the japanese character, then also length will return the length of the string not the bytes.

I want to calculate the number bytes of string,
if s="123" then it should return 3 and if s is of type string with the 3 japanese letters then it should return 6 bytes.



Thanks and Regards,
Asha.mp


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend