[AccessD] formatting strings and placing them in a larger str ing

Heenan, Lambert Lambert.Heenan at AIG.com
Wed Aug 11 15:59:14 CDT 2004


Air code....

Function InstertString(strInsert as String, strTarget As String, nPos as
Long) as String

Dim strLeft as String, strRight as String

	If Len(strTarget) < nPos + 1 Then
		' do something about this error condition
	Else
		strLeft = Left(strTarget,nPos)
		strRight = Mid(strTarget,nPos + 1)
		strTarget = strLeft & strInsert & strRight
		InstertString = strTarget
	End If
End Function

Lambert

> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John
> Sent:	Wednesday, August 11, 2004 2:49 PM
> To:	'Access Developers discussion and problem solving'
> Subject:	RE: [AccessD] formatting strings and placing them in a
> larger str ing
> 
> Cool, now I need to know how to place a string of len N at position O in
> another string.
> 
> This is for export to a mainframe where the string they want is about
> 3,000
> characters, of which a total of about 200 characters will actually have
> data
> from us.
> 
> So:
> 
> Insert in a string of blanks (spaces), at position 12, a string of length
> 10.  REPLACE 10 characters with my 10 characters, starting at position 12.
> Insert in a string of blanks, at position 60, a string of length 25.
> Insert in a string of blanks, at position 124, a string of length 13.
> 
> Etc.
> 
> I have a field map of their data, and I can brute force it by just
> appending
> strings together.  I think it was Gustav that suggested a smarter way
> using
> a built in VB function.
> 
> JWC
> 
> 
> -----Original Message-----
> From: Brett Barabash [mailto:BBarabash at tappeconstruction.com]
> Sent: Wednesday, August 11, 2004 2:19 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] formatting strings and placing them in a larger
> string
> 
> 
> String("@",40) 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John
> Sent: Wednesday, August 11, 2004 12:33 PM
> To: 'accessd at databaseadvisors.com'
> Subject: [AccessD] formatting strings and placing them in a larger
> string
> 
> I need to take some piece of data, format it correctly (yyyymmdd for
> dates, $$$$.CCCC  for currency, XXXX.DD for other floats, etc.
> 
> I then need to place it in a specific length field, padded left with
> spaces.
> 
> I then need to insert that string inside of a larger string at a
> specific location.
> 
> Someone posted a solution for placing a string inside a larger string
> but I can't find the email.
> 
> I can build up a string of @ characters into the correct length using a
> simple:
> 
>     While Len(strPad) < mintLen
>         strPad = strPad & "@"
>     Wend
> 
> But is there any way to just specify that I want a string of 40 @
> characters?
> 
> JWC
> --
> 
> --------------------------------------------------------------------------
> --
> ----------------------------------------
> The information in this email may contain confidential information that 
> is legally privileged. The information is only for the use of the intended
> 
> recipient(s) named above. If you are not the intended recipient(s), you 
> are hereby notified that any disclosure, copying, distribution, or the
> taking 
> of any action in regard to the content of this email is strictly
> prohibited.
> If 
> transmission is incorrect, unclear, or incomplete, please notify the
> sender 
> immediately. The authorized recipient(s) of this information is/are
> prohibited 
> from disclosing this information to any other party and is/are required to
> 
> destroy the information after its stated need has been fulfilled.
> 
> Any views expressed in this message are those of the individual
> sender, except where the sender specifies and with authority,
> states them to be the views of Tappe Construction Co.
> 
> This footer also confirms that this email message has been scanned
> for the presence of computer viruses.Scanning of this message and
> addition of this footer is performed by SurfControl E-mail Filter software
> in conjunction with virus detection software.
> 
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list