Hi All
I'm having problems printing a string with a % char. Here is the code
line = sprintf("<table width=100% id=%s>\n", $table_id);
I'm getting an not enough parameter error. The % for the 100% is being
mis interepreted as a format char. Though i worked around by coding it
line = sprintf("<table width=100%s id=%s>\n", '%', $table_id);, i think
there should be a way with which the % can be escaped PHP.
The PHP documention does not have any info about this. if anyone has
come accross such problems and found a work around, please help me out.
Thanks
/V 6 2636
Double % sign.
sprintf("<table width='100%%' id='%s'>\n", $table_id);
-Jay
Venkat Venkataraju wrote: Hi All
I'm having problems printing a string with a % char. Here is the code
line = sprintf("<table width=100% id=%s>\n", $table_id);
I'm getting an not enough parameter error. The % for the 100% is being mis interepreted as a format char. Though i worked around by coding it line = sprintf("<table width=100%s id=%s>\n", '%', $table_id);, i think there should be a way with which the % can be escaped PHP.
The PHP documention does not have any info about this. if anyone has come accross such problems and found a work around, please help me out.
Thanks /V
Jay Moore wrote: Double % sign.
sprintf("<table width='100%%' id='%s'>\n", $table_id);
doesn't seems to work. it still asks for more parms. i also did \%, but
it is not working either.
/V
Venkat Venkataraju wrote: Jay Moore wrote:
Double % sign.
sprintf("<table width='100%%' id='%s'>\n", $table_id); doesn't seems to work. it still asks for more parms. i also did \%, but it is not working either.
/V
Works just fine for me. Make sure you don't have any typos.
-Jay
Venkat Venkataraju wrote: Hi All
I'm having problems printing a string with a % char. Here is the code
line = sprintf("<table width=100% id=%s>\n", $table_id);
I'm getting an not enough parameter error. The % for the 100% is being mis interepreted as a format char. Though i worked around by coding it line = sprintf("<table width=100%s id=%s>\n", '%', $table_id);, i think there should be a way with which the % can be escaped PHP.
The PHP documention does not have any info about this. if anyone has come accross such problems and found a work around, please help me out.
Thanks /V
If it's anything like C++ (as PHP usually is), and if I remember my c++
correctly, it's going to be %%. Try that.
-- Inuyasha4Life
In message <h1*********************@newssvr28.news.prodigy.co m>, Venkat
Venkataraju <segfault@?.?.invalid> writes Hi All
I'm having problems printing a string with a % char. Here is the code
line = sprintf("<table width=100% id=%s>\n", $table_id);
I'm getting an not enough parameter error. The % for the 100% is being mis interepreted as a format char. Though i worked around by coding it line = sprintf("<table width=100%s id=%s>\n", '%', $table_id);, i think there should be a way with which the % can be escaped PHP.
The PHP documention does not have any info about this. if anyone has come accross such problems and found a work around, please help me out.
You have a percent literal in the line. You can just concatenate it:
line = "<table width=100% id=" . $tableid . ">\n";
--
Five Cats
Email to: cats_spam at uk2 dot net
Venkat Venkataraju <segfault\"@\"nospam.sbcglobal.net> wrote: line = sprintf("<table width=100% id=%s>\n", $table_id);
This will work:
line = sprintf("<table width=100%s id=%s>\n", '%', $table_id);
--
Spam is spam no matter who's doing it or for what reason. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Illuzioner |
last post by:
hey all,
can anyone enlighten me on the proper c++ way to print formatted text into a
string?
e.g.
string mytext;
double nn=445566.332211;
|
by: huey_jiang |
last post by:
Hi All,
I am trying to figure out a right syntax to convert an integer array
into hex array. sprintf worked for me on doing single integer:
int i, Iarray, n=15;
char buf;
sprintf(buf,...
|
by: junky_fellow |
last post by:
Consider an implementation that doesn't use all bits 0 to represent
a NULL pointer. Let the NULL pointer is represented by 0x12345678.
On such an implementation, if the value of NULL pointer is...
|
by: babak |
last post by:
Hi everyone
I want to format a string (using sprintf) and put it in a messagebox
but however I try to do it, it doesn't seem to work.
Here is an example sample of what i try to do:
char msg;...
|
by: Neal Barney |
last post by:
I have a C program which runs on a device using a Zilog Z180
microprocessor. While it can address 1MB of RAM, it can only address
64KB at any given time. And of that only 16KB can be used for...
|
by: bwaichu |
last post by:
Now, I read the faq, and it suggests using sprintf. However,
I want to all ways know where the integer finishes in the string.
Basically, I want to:
nbr | other data
But the other data all...
|
by: mac |
last post by:
Hi,
I'm trying to write a fibonacci recursive function that will return
the fibonacci string separated by comma. The problem sounds like this:
-------------
Write a recursive function that...
|
by: 2b|!2b==? |
last post by:
I am not making much progress porting some old C code to C++ ...
I am porting the lines below, which prints an ISO8601 date string:
char buff ;
memset(buff, '\0',16);...
|
by: nospam |
last post by:
If I have a string say:
myvar = "This is a string";
How do I use sprintf to convert the string so it has 4 spaces padded on
the left like:
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |