check if string is base64 encoded

hey all
currently i use the following piece of code to check if the string passed to me can be converted to base64, it is not very efficient and bad, can someone please suggest another of doing this

private string ConvertBase64ToString(string[] content)
StringBuilder sb = new StringBuilder();
int i = content.GetUpperBound(0);
for (int j=0; j<i; j++)
// if successful in converting base64 append it.
catch (Exception)
// cannot be decoded so append the original string
return sb.ToString();

content passed to be looks like:
some string not containing base64
another strign without base64

some more strings without base64

is it possible to somehow find out if a line is base64 without attempting to covert it and catching the exception?


4/5/2005 8:29:02 PM 91979 articles. 4 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 54
Get it on Google Play
Get it on Apple App Store


Similar Artilces:

getting base64 encoded string using IdHttp
yes hello good to be back... so i have written a REST server in PHP to talk to my IdHttp client that base64 encodes a jpeg in order to send the data in a record "packet" of my own design. I then use a TStringList.delimitedText to read the received packet and parse the results into key/value pairs (kind of a homestyle JSON format). this is working well for all the other data, but it seems that the base64 field is being limited to 4096 bytes when i call the RawByteString thumb64 := tsServerReply.Values['base64field']; the original 'base64field' i...

NET::LDAP, somewhere the new userPassword gets base64 encoded
I'am using the Perl Net::LDAP Module with openldap-2.3.24 (uses LDAP protocol Version 3). I need to update the userPassword field, the problem is that somewhere in the middle the new password i'am giving gets base64 encoded. As to my understanding i'am preparing the whole password. In the password i'am putting first the encoding type: {MD5}, {SSHA}, etc and then the hash. No matter what i do, even the supposed encoding type gets base64 encoded once in the Server. I'am not sure if it is Net::LDAP or the server itself who is doing this: I've tried ...

To Encode String or to Not Encode String... Answer?
I am importing a CSV file from a Unix server as a string, and then saving the string into a new file for later processing.  However, this process does not always work.  As this CSV file is VERY, VERY large, I am unable to immediately tell if the fault lies with my code, or the CSV file provider (very possible).  The only time I can tell that this happened is when the data is not populated the next morning.  The fault appears to lie in there being extra or missing commas, as when I try to run the data import manually, STRINGs are attempted to be inserted into INT...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

How to get encoding of string
I need to get encoding of some string. how can I do it? ThanksIreland's classifieds | UK classifieds...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Encoding a string to base64
Hi, I recently downloaded a source code (n_cryptoapi) which i have tried using to encode a string to base64 but i'm getting incorrect results. string = 0116112006003 actual result = MAAxADEANgAxADEAMgAwADAANgAwADAAMwA= expected result = MDExNjExMjAwNjAwMw what am i doing wrong? I'm using the encode64 function = String ls_encoded ULong lul_len, lul_buflen Boolean lb_rtn lul_len = Len(ablob_data) lul_buflen = lul_len * 2 ls_encoded = Space(lul_buflen) lb_rtn = CryptBinaryToString(ablob_data, & lul_len, CRYPT_STRING_BASE64, & ls_encoded, lu...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

Getting all text at start of a string
Hello,I have a string (from a weather feed) that looks like:Monday: Mainly Sunny, 25.5°C Is it possible to get everything before the :So I can just get the day, and not the conditionsThe idea is that the feed looks likeMonday: asdsfasfMonday Night: asdsfasfTuesday: AFASFetc,Thanks  Try this: string s = "Monday: Mainly Sunny, 25.5°C"; string d = s.Split(':')[0];Thanks, EdMicrosoft MVP - ASP/ASP.NET...

Getting a base64 string from a webactivity
I was wondering if i could get a base64 string from a webactivity after cal= ling the camera or=A0 the gallery and picking an image=0Ais this possible? = any sample?=0A ...

Base64 encode zipped string
Hello Group, I want to create a set of functions that allows me to do the following: function CompressAndEncodeString(InString: string): string; begin CompressInString using zip algo or whatever Base64 encode compressed Instring and assign to result end; and function RetrieveString(Instring: string): string begin Base64 decode Instring Uncompress decodestring and assign to result end; Googled for the different parts, but got lost in the complexity. Any help is very much appreciated! Willem -- Willem van Deursen, The Netherlands wvandeursen_nospam@...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Getting started .net website
Hi folks,Does anyone here know of a good website to just sit back and read for learning .net? Thanks in advance.Baldeep Right here... Click the Get Started and Learn sections here. Quite a few out there - - this one, has a lot of good videos -  also, but then, I might be a little prejudiced David WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(P...

Getting Started with .net and a few questions
Hello I've done some asp and php programming along with various other languages in the past and slowing getting my head around .net.I have a small project of creating a Holiday Booking system on our Intranet and just trying to get the first part to work properly will hopefully get me sorted for the whole project. The Intranet is running on .net 2 and I prefer to use the VB code rather than C#. This is connecting to an SQL server.My initial page that I am trying to create is just for an admin user to view which dates in a table have been specified as Bank Holidays and be able to add ...

Web resources about - check if string is base64 encoded -

Encoded Archival Description - Wikipedia, the free encyclopedia
EAD originated in 1993, at the University of California, Berkeley . The project's goal was to create a data standard for describing archives, ...

All sizes - Life, encoded - Flickr - Photo Sharing!
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Are Shakespeare's Plays Encoded within Pi? - YouTube
A follow-up, with examples of numbers that are infinite and non-repeating but don't contain all combinations of digits: ...

'Encoded Intonation': Turning Dinnertime Conversation into Bespoke Tableware
... designer Sophia Thomas has created a subtle way to embody those dear moments with friends over a meal with her ongoing series, " Encoded Intonation ...

Cosmic Rebirth Encoded in Background Radiation?
A pattern discovered in the cosmic microwave background radiation may chronicle what happened before the Big Bang.

​Researchers deliver encoded messages and data through your smartphone compass
NFC, Bluetooth, WiFi, mobile data, plain 'ole voice calls. Your phone has no shortage of ways to connect with things, but that hasn't stopped ...

JavaScript: Retrieve and paginate JSON-encoded data
I’ve created a jQuery plugin that allows you to retrieve a large data set in JSON format from a server script and load the data into a list or ...

Snowden Has Shared Encoded Copies of NSA Files in Case Anything Happens to Him
... should happen to Edward Snowden the files he acquired from the NSA will live on. According to Glenn Greenwald , Snowden has given encoded copies ...

4 out of 5 videos are encoded in H.264
A full 80 percent of videos are encoded in H.264, according to new data from MeFeedia. The latest figures show just how far the industry has ...

Seized Memory Card Contained al Qaeda Documents Encoded in Porn
... his underwear, they were suspicious—but it seemed only to contain porn. Later investigation, however, reveals that one film was actually encoded ...

Resources last updated: 12/9/2015 11:36:19 PM