• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Formatting a string

Hi ,there.

Consider the following code

 int x =0;
 int y =0;
 int z =100;
 int w =100;

 CString string;
 string.Format("%%BoundingBox %d %d %d %d \n" ,x ,y ,z ,w);

 I want the function to display something like :

 %%BoundingBox 0 0 100 100

 But it displays:

 %BoundingBox 0 0 100 100  

instead.As you can see , a"%" is missing .How to solve this .If I try and add another "%" at the beginning of the string ,the function asserts.

1 Solution
use this
CString string;
string.Format("%%%%BoundingBox %d %d %d %d \n" ,x ,y ,z ,w);

% - special symbol
%% - print one %


Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now