realbasic-nug.de
[Top] [All Lists]

Re: String aufteilen

To: REALbasic NUG German <realbasic-nug dot de at lists dot realsoftware dot com>
Subject: Re: String aufteilen
From: Stefan Mettenbrink <S dot Metti at gmx dot de>
Date: Fri, 5 May 2006 15:52:38 +0200
Delivered-to: realbasic-nug dot de at lists dot realsoftware dot com
References: <3229659306 dot 247766106635 at [192 dot 168 dot 178 dot 21]> <1heutx2 dot 11e31zg1ugkxfwM%support at monkeybreadsoftware dot de>
Christian Schmitz wrote:

Ich möchte einen langen String in 40 Zeichen lange Zeilen mit
Zeilenumbruch wandeln.

Wie wäre es in einer Schleife, die das macht?

n=0
while n<len(text)
teilchen=mid(text, n*40+1, 40)
n=n+40
array.append teilchen
wend

Ich hatte gehofft, etwas schnelleres zu bekommen.
Wäre es mit MemoryBlock schneller?

Na ja, ich denke, es geht so auch.
Danke.

MfG, Metti.


From  Fri 5 May 2006 16:16:23 +0200
Return-Path: <realbasic-nug dot de-bounces at lists dot realsoftware dot com>
Received: from lists.realsoftware.com (209.198.132.125) by realsoftware.com
with ESMTP (Eudora Internet Mail Server 3.1.3);
Fri, 5 May 2006 09:16:31 -0500
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id B81D2124614A; Fri,  5 May 2006 09:16:28 -0500 (CDT)
X-Original-To: realbasic-nug dot de at lists dot realsoftware dot com
Delivered-To: realbasic-nug dot de at lists dot realsoftware dot com
Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de
        [80.67.18.44])
        by lists.realsoftware.com (Postfix) with ESMTP id 108F3124613E
        for <realbasic-nug dot de at lists dot realsoftware dot com>;
        Fri,  5 May 2006 09:16:25 -0500 (CDT)
Received: (qmail 2537 invoked from network); 5 May 2006 14:16:22 -0000
Received: from unknown (HELO [192.168.1.80]) (363246 at [84 dot 175 dot 118 dot 
176])
        (envelope-sender <support at monkeybreadsoftware dot de>)
        by smtprelay06.ispgateway.de (qmail-ldap-1.03) with SMTP
        for <realbasic-nug dot de at lists dot realsoftware dot com>; 5 May 
2006 14:16:22 -0000
To: realbasic-nug dot de at lists dot realsoftware dot com (REALbasic NUG 
German)
In-Reply-To: <3229690058 dot 249199106541 at [192 dot 168 dot 178 dot 21]>
From: support at monkeybreadsoftware dot de (Christian Schmitz)
Date: Fri, 5 May 2006 16:16:23 +0200
Message-ID: <1hevh57 dot 13n2dmh1l1ebqyM%support at monkeybreadsoftware dot de>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Organization: Monkeybread Software Germany
X-Face: nrf3>{WQ6c&r+7 at e)"]0G60`-6ND^)I2mI%>)QGYa=9"=7jhd-g2|b3!>Al0+
        Ccb%xGQshhi|g at QU2$
User-Agent: MacSOUP/D-2.7 (Mac OS X version 10.4.6)
Subject: Re: String aufteilen
X-BeenThere: realbasic-nug dot de at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG German <realbasic-nug dot de at lists dot realsoftware dot 
com>
Sender: realbasic-nug dot de-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug dot de-bounces at lists dot realsoftware dot com

Stefan Mettenbrink <S dot Metti at gmx dot de> wrote:

Ich hatte gehofft, etwas schnelleres zu bekommen.
Wäre es mit MemoryBlock schneller?

Wie schneller?

Da sind zwei bremsen:

1. String Kopieren
2. Array vergrößern

wenn du das Array vorher in passender Größe anlegst und füllst ohne
append, kann das schneller werden.

und mach auch mal ein

a(ubound(a))=" "

damit das Array direkt allokiert wird.

Gruß
Christian

--
Around eleven thousand functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v6.1.
<http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>


<Prev in Thread] Current Thread [Next in Thread>