vb.net | convert base64Binary to pdf

First convert from your base64 string to a byte array: Dim bytes As Byte() = Convert.FromBase64String(base64_string) Next save the byte array to disk: Dim stream As System.IO.FileStream = New FileStream(“C:\mypdf.pdf”, FileMode.CreateNew) Dim writer As System.IO.BinaryWriter…

Get unix micro time in VB.NET

Public Shared Function GetUnixMicroTime() As String Dim origin As DateTime = New DateTime(1970, 1, 1, 0, 0, 0, 0) Dim diff As TimeSpan = Now() – origin Return CStr(diff.TotalSeconds) End Function

Uppercase first in VB.Net

To capitalize only the first character of a string you can create an extension, like this: Public Module MyModule Public Function UppercaseFirst(my_string As String) As String If String.IsNullOrWhiteSpace(my_string ) OrElse my_string .Length < 2 Then...

Rtrim and Ltrim specific chars in VB.Net

Dim char_array_end = "<br />".ToCharArray Dim char_array_start = "I ".ToCharArray Dim my_string = "I love pizza, beer, sambuca<br />" Dim my_string_trimmed = my_string.TrimEnd(char_array_end) Console.WriteLine(my_string_trimmed) ‘I love pizza, beer, sambuca’ my_string_trimmed = my_string.TrimStart(char_array_start) Console.WriteLine(my_string_trimmed) ‘love pizza,…

VB.NET – Trim all rows in a string

Dim my_string As String = vbTab & “row1 ” & vbNewLine & “” & vbTab & ” row2 ” Dim rows As String() = my_string.Split(vbNewLine) Dim text As StringBuilder = New StringBuilder For Each row…