Skip to main content
added 137 characters in body
Source Link
Mr.Frodo
  • 5.8k
  • 1
  • 17
  • 37

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

Other option is by using String.valueOf() of String class but not suggested as this returns useless string like Blob[X] where X is the number of bytes in the blob.

There is one answer of sfdcfox which you might want to check before doing anything with blob. It says:

String.valueOf is always safe to use on a Blob, but Blob.toString may result in an exception if the contents are not a Unicode String.

So use toString() with Try-Catch block. Check comments too for more details.

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

Other option is by using String.valueOf() of String class.

There is one answer of sfdcfox which you might want to check before doing anything with blob. It says:

String.valueOf is always safe to use on a Blob, but Blob.toString may result in an exception if the contents are not a Unicode String.

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

Other option is by using String.valueOf() of String class but not suggested as this returns useless string like Blob[X] where X is the number of bytes in the blob.

There is one answer of sfdcfox which you might want to check before doing anything with blob. It says:

Blob.toString may result in an exception if the contents are not a Unicode String.

So use toString() with Try-Catch block. Check comments too for more details.

added 6 characters in body
Source Link
Mr.Frodo
  • 5.8k
  • 1
  • 17
  • 37

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

Other option is by using String.valueOf() of String class.

There is one answer of sfdcfox which you might want to check before doing anything with blob. It says:

String.valueOf is always safe to use on a Blob, but Blob.toString may result in an exception if the contents are not a Unicode String.

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

There is one answer of sfdcfox which you want to check before doing anything with blob

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

Other option is by using String.valueOf() of String class.

There is one answer of sfdcfox which you might want to check before doing anything with blob. It says:

String.valueOf is always safe to use on a Blob, but Blob.toString may result in an exception if the contents are not a Unicode String.

Source Link
Mr.Frodo
  • 5.8k
  • 1
  • 17
  • 37

You can use toString() of Blob class.

Example:

String myString = 'StringToBlob';
Blob myBlob = Blob.valueof(myString);
System.assertEquals('StringToBlob', myBlob.toString());

There is one answer of sfdcfox which you want to check before doing anything with blob