×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,544

    Re: Adding two strings

    Quote Originally Posted by melepeta View Post
    Hello i want to add two strings together.
    _LIT(errormain,"Error: ");
    _LIT(errorstr,"Message ");


    Normally it could be done like this:

    errormain = errormain + errorstr; but i get error: no match for 'operator+' so should i make my own string adding functions or theres an eaisier way to do it?
    You can use Append. But I notice you are not following the 'Symbian' way of naming conventions either. Here is something that everybody finds very useful when starting off with Symbian http://descriptors.blogspot.fi/ There you will find answer to your query too

    Edit: My answer gets an older time-stamp compared to the question ..yet again

  2. #2
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Adding two strings

    Hello i want to add two strings together.
    _LIT(errormain,"Error: ");
    _LIT(errorstr,"Message ");


    Normally it could be done like this:

    errormain = errormain + errorstr; but i get error: no match for 'operator+' so should i make my own string adding functions or theres an eaisier way to do it?

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,694

    Re: Adding two strings

    In short:
    1) _LIT-s are defining literals, string constants. So "errormain=" can not work
    2) Symbian descriptors (the thing we have for/instead of strings) are objects, which actually have = and += operators, but no +: http://www.symlab.org/main/documenta...BF3D544CD.html
    So you could do
    Code:
    TBuf<30> buf;
    buf=errormain;
    buf+=errorstr;
    (side note: TDes linked in 2) is an "abstract" superclass, and TBuf is an actual implementation, TBuf behaves as a bounded array, with length defined in compilation time)

Similar Threads

  1. Fonts work with hard coded strings but not Resource strings
    By maclondon in forum Windows Phone General
    Replies: 14
    Last Post: 2013-09-27, 12:49
  2. Cant see strings
    By alexs@servision.net in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2010-10-19, 14:42
  3. strings?
    By praktikant in forum Symbian
    Replies: 4
    Last Post: 2007-07-13, 09:28
  4. utf-8 strings in C++
    By sopta007 in forum Symbian
    Replies: 1
    Last Post: 2003-10-08, 09:15
  5. Adding more than two strings in a single listbox item
    By prbhat in forum Symbian User Interface
    Replies: 2
    Last Post: 2003-07-08, 14:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×