WString Convert

Hi!

what ist the best methode to convert wstrings to wlong/wfloat and back
to wstring.


Thanks to all who reply...

0
Thomas
5/13/1998 1:32:24 PM
sybase.power++.general 2129 articles. 0 followers. Follow

4 Replies
1010 Views

Similar Articles

[PageSpeed] 57

Thomas Lauer wrote:
> 
> Hi!
> 
> what ist the best methode to convert wstrings to wlong/wfloat and back
> to wstring.
> 
> Thanks to all who reply...
WString class has methods to convert to long\floats.
The other way around,I guess,  you'll have to use sprintf to populate
your string ...

Regards,
Hari Stirbet
Sybase, Inc.
0
Hari
5/13/1998 5:13:52 PM
Tomas,

    I like to use the Sprintf method of WString to convert longs and floats
to strings.  The WString class also has the method ConvertToLong() to
convert WStrings to longs.  But I'm not sure about WStrings to floats.  If
you cann't find a method of WString to convert them to floats try using

#include <stdio.h>
int scanf( const char *format, ... );

I'm pretty sure it can convert WString to floats.


0
Andres
5/14/1998 12:22:00 PM
Thomas Lauer schrieb in Nachricht <3559A0E8.EE1531CD@itteam.com>...
>Hi!
>
>what ist the best methode to convert wstrings to wlong/wfloat and back
>to wstring.
>
>
>Thanks to all who reply...
>

You can use the properties Double and Long and Sprintf, to format a float.
But if the local decimal separator is not a point, you should replace it
with a point.

I'm missing methods, that use the local settings for the decimal and
thousand separator, and can format numbers, date, time or currency.
Also the variant class WDataValue has the same disadvantages.

regards
herbert menke





0
Herbert
5/14/1998 2:33:56 PM
Quite some time ago, I wrote a C function for converting float to string
that I still use.

buff is just a pointer to a char string that you pass in order to
retrieve your string version of the float.

places is how many decimal places you want.

void DataConversion::FloatToString( char * buff, double value, int
places )
{
    int decimal, sign, I;
    int offset = 1;
    char *ptbuff;
    char tbuff[11];

    ptbuff = fcvt(value,places,&decimal,&sign);

    strcpy(tbuff,ptbuff);
    if ( sign == 0 )
        strcpy(buff," ");
    else
        strcpy(buff,"-");
    if ( decimal > 0 )
        strncat(buff,tbuff,decimal);
    else
        { strncat(buff,"0 ",1); offset = 2; }
    strncat(buff,". ",1);
    if ( decimal < 0 )
        {
        do
            {
            strncat(buff,"0 ",1);
            decimal++;  places--; offset++;
            }
        while( decimal < 0 );
        }
    for ( I=1; I<=places; I++ )
        strcpy(&buff[decimal+offset+I],&tbuff[decimal-1+I]);
    strcat(buff,"\0");
    if ( buff[0] == ' ' )
        {
        for ( I=1; I<strlen(buff); I++ )
            tbuff[I-1] = buff[I];
        tbuff[I-1] = 0;
        strcpy(buff,tbuff);
        }
}

0
David
5/21/1998 3:09:33 AM
Reply:

Similar Artilces:

power in Power
What does the ^ operator? I thought that it was the powering operator, but when I got 3^2=1 instead of 9... OK, I know there is pow function somewhere, but anyway... Saso On Sat, 5 Sep 1998 15:56:35 +0200, "Saso Zivanovic" <zivanovic@fmf.uni-lj.si> wrote: >What does the ^ operator? I thought that it was the powering operator, but >when I got 3^2=1 instead of 9... OK, I know there is pow function somewhere, >but anyway... > >Saso > > Hi, Saso The '^' operator is bitwise exclusive or. Although you can do some things with Po...

What generals generally do
Reading a McChrystal thread elsewhere, I came across someone quoting a US general http://en.wikipedia.org/wiki/Smedley_Butler > I spent 33 years and four months in active military service and > during that period I spent most of my time as a high class thug for > Big Business, for Wall Street and the bankers. In short, I was a > racketeer, a gangster for capitalism. I helped make Mexico and > especially Tampico safe for American oil interests in 1914. I helped > make Haiti and Cuba a decent place for the National City Bank boys to > collect revenues in. I ...

Convert nsString to wstring
Hi all ! I have a problem with a convert function in my XPCOM component : wstring nsTimmy::ConvertToWString(nsString * source) { wstring dest; const PRUnichar *begin, *end; wchar_t wideChar; begin = (*source).BeginReading(); end = (*source).EndReading(); while(begin != end) { wideChar = (wchar_t)*begin; dest.append(&wideChar); ++begin; } return dest; } This function works with Windows and visual studio compiler but not with linux and GCC 4.1. It builds and doesn't crash at execution but the characters returned in dest are juste wrong. Th...

Convert PB7 application to Power J
My question IS: It is possible to convert an application whitch developped with PB7 to PowerJ? If it is possible , can you tell me the procedure. Thank you. Yeah, line by line ;>) This would require a complete rewrite, there is no automated to do this. On Thu, 8 Feb 2001 05:23:21 -0500, serge.tchitembo@wanadoo.fr wrote: >My question IS: >It is possible to convert an application whitch developped with PB7 to >PowerJ? >If it is possible , can you tell me the procedure. > >Thank you. See PowerBuilder Developer's Journal November 2000 - Vol 7 Iss...

Converting existing Power++ code to ActiveX?
Has anyone done this? What do I have to do? How hard is it? Thanks, Jim ...

Convert triggers from ERWin to Power Designer.
Someone know how convert triggers from ERWin to Power Designer. Them big problem is macros %joinPKPK im erwin trigger template. Someone can help-me Rom You will probably need custom code to convert that macro into something PowerDesigner can work with. What version/build of PowerDesigner? -- Mike Nicewarner [TeamSybase] http://www.datamodel.org mike@nospam!datamodel.org Sybase product enhancement requests: http://www.isug.com/cgi-bin/ISUG2/submit_enhancement <Rom> wrote in message news:3fcc973c.3928.846930886@sybase.com... > Someone know how convert triggers ...

Convert triggers from ERWin to Power Designer. #2
NewsGroup: sybase.public.powerdesigner.general Date: Dec 2,2003 05:37 am Created by: Rom Topic: Convert triggers from ERWin to Power Designer. Someone know how convert triggers from ERWin to Power Designer. Them big problem is macros %joinPKPK im erwin trigger template. Someone can help-me Rom NewsGroup: sybase.public.powerdesigner.general Date: Dec 9,2003 03:15 am Created by: Rom Topic: Re: Convert triggers from ERWin to Power Designer. version 9.5.2.873 ok, i customized my code and it works, but my problem is the conditional macro, because power ...

general SQL syntax converter from sqlany to transact ?
Maintaing a SYBASE (11) database, consolidated from a few (<=10) SQLANY db's, we often convert sql from one syntax to the other. Is there a general syntax converter ? Using Transact-SQL to access Anywhere works slower than it's native syntax. >Maintaing a SYBASE (11) database, consolidated from a few (<=10) SQLANY >db's, we often convert sql from one syntax to the other. >Is there a general syntax converter ? >Using Transact-SQL to access Anywhere works slower than it's native syntax. If you put the sql in a stored procedure, using sybase central yo...

Memory leaks in Power++ using WString in development envirnoment?
Hello, I am having a problem with memory leaks with the Power++ development environment. When I run a debug version of my application which makes heavy use of the WString class, the memory usage goes wild. Further, when the applications finishes, or I terminate it, the memory is still not freed. This only happens with a debug target, not a release target. I can run the debug .exe or the release .exe on it's own with no excess memory usage. It's only when I run the debug target from within Power++ development environment that I get the problem. Further, after running my ...

Converting Excel "general" date into DateTime(Sql)
Hi,  I have an odd request.... I am importing data from an excel spreadsheet to a sql db. Inside the excel spreadsheet, I have a column with dates in it, I need these dates to be imported as text to the sql DB field(which is a varchar datatype).   The problem is, at the moment, if I insert a date 2006/08/30 it displays it like this in the sql DB: 38959 Is there a way this can be converted back to the date? even possibly before it is stored in the sql DB ? I am currently bulk copying the excel data to sql DB. The code im using is below: Thank you for any help/assistance Dim e...

Converting std::string app to Unicode
(Not non-technical but not sure which forum to post on). In my application originally developed in C++Builder 5, I mostly use "std::string" for strings; and I only convert to AnsiString at the point of interfacing with VCL functions. Now when porting to XE5, I need to be able to interface with UnicodeStrings. Generally speaking - is it better that I change all my code to use "std::wstring" ; or should I continue to use "std::string" but do to/from UTF-8 conversion at the point of interfacing with UnicodeString? Matt wrote: > Generally speaking - ...

Power down by power button Frezzing
My laptop is frezzing when I press the power down button. Not completely though, I am able to minimize windows etc just not able to click anything on the panel thus I can't power off and end up having to hold the power button until the computer powers off. I was wondering if anyone had any ideas on how I could deal with this. As well I am wanting to set it up so that I could power of the computer simply by closing the lid. Thanks in advance for any help you can offer. -- tjstinson ------------------------------------------------------------------------ Are you al...

Power-on and reboot after power failure
Hi, I just set up a small school I volunteer at with a simple openSUSE 10.3 server in their computer lab. It's running on a Dell poweredge system. The Dell doesn't have anything I could find in BIOS or any other hardware level config settings that would tell it to reboot after a power failure. Right now, if the power fails and then comes back on the machine will sit there until someone hits the front panel "on" button. Not good. The research I did indicates that Dell's answer is that it's up to the operating system to "set the boot flag". ...

Power Tool /Power Cerv
Is there any way to access old user groups circa 1994-96 for discussions on Powertool/PowerCerv. Our Powerbuilder system was build with PowerTool version 4.1 and Power Cerv 4.0 as its ancestor objects. Its currently at PB6.5.1 every thing still works but I would imagine its going quit working in the next few operating systems. My real question is their any way to find old manuals as we build new addons its sometimes difficult to see/remember what its doing, other than surfing through the code. Getting selected rows to work with the cntrl-shift copy etc. Anyone remember u_dwa , u_cb, ...

Web resources about - WString Convert - sybase.power++.general

Most Useful Mess Of Wires: GPS Bus Notifier
Alright so I havent posted in a while, and the novelty of the wm+ has worn off. I dont have the funding to start a drone project right now, mainly ...

Cocoa - November 30, 2000
cocoa xcode cocoa xcode Cocoa - November 30, 2000 22:18 Cheetah Joshua Portway 16:12 Re: MacOSX-dev digest, Vol 1 #326 - 19 msgs Matthew Formica ...

std.string - D Programming Language - Digital Mars
Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for ...


Windows 7 UAC whitelist: Win7Elevate_Utils.h
See the detailed description for a step-by-step guide to what the code does. See the main page for compiled binaries, Visual Studio project, ...

Basic networking support in Windows Phone
... ^ NativeHttpClient ::GetStringAsync( Uri ^ uri) { return create_async([ this , uri] { return m_request.GetAsync(uri).then([](std::wstring ...

Introduction to C# PInvoke Interop SDK for C++ DLL - .NET PInvoke Interop SDK for C++ DLL
C# PInvoke Interop SDK for Native C++ DLL, C# .NET Wrapper Generator for Native C++ DLL Automatically, Wrapping C++ classes from C# .NET via ...

FBWiki: CatPgString
FBWiki : CatPgString FBWiki :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register String Functions Statements and ...

omniORB features
omniORB features Destinations omniORB home History Features Download Documentation Wiki FAQ Bugs Development Snapshots SF project ...

Issues for Ilya Sherman - Code Review
Keyboard Shortcuts File u : up to issue m : publish + mail comments M : edit review message j / k : jump to file after / before current file ...

Resources last updated: 11/24/2015 5:33:48 AM