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 2667
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************ *********@newss vr28.news.prodi gy.com>, Venkat
Venkataraju <segfault@?.?.i nvalid> 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\"@\"n ospam.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, "0x%02x", n);
The above code worked. Howeve, what I am trying to do is to convert an
|
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 printed
will it be all 0's or 0x12345678
int main(void)
{
char *ptr;
ptr = 0;
|
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;
string my_name = "John";
sprintf (msg, "My name is: %s ", my_name);
MessageBox(NULL, msg, NULL, MB_OK);
|
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 "stack
and heap space". So I'm running in a very memory constricted
environment.
The program "speaks" a proprietary protocol which sends ASCII strings
back and forth from the device to the server. Within the past couple of
months we've been...
| |
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 ways has to start at the same place. I had
some problems using sprintf to accomplish this requirement. Maybe
I am overlooking something. But sprintf translates the nbr exactly
into
|
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 creates a character string containing
the first n Fibonacci numbers - F(n) = F(n - 1) + F(n - 2), F(0) =
F(1) = 1 -, separated by comma. n should be given as an argument to
the program. The recursive function should only take one parameter, n,
and...
|
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);
sprintf(buff,"%02d:%02d:%02d", hours, minutes, seconds) ;
to :
|
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: 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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |