Solved

How can i parse and check if a string is in BASE64 format?

Posted on 2008-06-13
4
953 Views
Last Modified: 2013-11-07
Hi experts,

Is there a way to check/parse a string and see if it is a valid base64 ?

because i don't want to do a try/Catch, guess it will slow my system if we don't have base64 string...


Regards
0
Comment
Question by:Dnx_7
  • 2
  • 2
4 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
You can make some checkings, like the valid characters:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ plus the = sign

also have a look to the following explanation about how a base64 string is made:
http://en.wikipedia.org/wiki/Base64
0
 
LVL 2

Author Comment

by:Dnx_7
Comment Utility
Hi,

i'm agree with you but suppose the application receive a string like this : "Hello=/Script"
kind of valid base64?!

Regards.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
Comment Utility
well, you have to entirely process the base64 string.
You can use this ready-made source code as a base:
http://www.codeproject.com/KB/cs/base64encdec.aspx
0
 
LVL 2

Author Comment

by:Dnx_7
Comment Utility
Thank you!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now