我覺得冠軍本身是不言自明。 powerbuilder中是否有任何功能等同於PHP的「爆炸」功能?是否有任何PowerBuilder的功能,相當於PHP的「爆炸」功能
對於PHP的「爆炸」,請訪問以下鏈接:PHP explode
我覺得冠軍本身是不言自明。 powerbuilder中是否有任何功能等同於PHP的「爆炸」功能?是否有任何PowerBuilder的功能,相當於PHP的「爆炸」功能
對於PHP的「爆炸」,請訪問以下鏈接:PHP explode
不內置,但PFC鏈服務具有of_parse_to_array()
它做同樣的事情,因爲PHP的explode()
,除了限制。如果你沒有使用PFC,你可以只舉起of_parse_to_array()
(當然保持的版權聲明),或者你可以抓住pfc_n_base,n_base,pfc_n_cst_string和n_cst_string並擁有了整個弦業務。如果你真的需要限制,可以很容易地添加of_parse_to_array()
實現限制重載版本。
如果您希望字符串解析爲許多標記,則_limit_會很有用,但您只對第一個_n_感興趣。 – 2010-06-30 14:13:54
PowerBuilder的被幾乎完全用於數據庫密集型應用程序,它可能是更方便的使用你的數據庫系統這一點。
如果您正在使用Sybase SQL Anywhere的,運行時它的附帶PowerBuilder中,你可以使用sa_split_list
system procedure
或者你可以建立自己的。該PFC包含此功能,您可以使用
//////////////////////////////////////////////////////////////////////////////
//
// Function: of_ParseToArray
//
// Access: public
//
// Arguments:
// as_Source The string to parse.
// as_Delimiter The delimeter string.
// as_Array[] The array to be filled with the parsed strings, passed by reference.
//
// Returns: long
// The number of elements in the array.
// If as_Source or as_Delimeter is NULL, function returns NULL.
//
// Description: Parse a string into array elements using a delimeter string.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Fixed problem when delimiter is last character of string.
// Ref array and return code gave incorrect results.
//
//////////////////////////////////////////////////////////////////////////////
//
/*
* Open Source PowerBuilder Foundation Class Libraries
*
* Copyright (c) 2004-2005, All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted in accordance with the GNU Lesser General
* Public License Version 2.1, February 1999
*
* http://www.gnu.org/copyleft/lesser.html
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals and was originally based on software copyright (c)
* 1996-2004 Sybase, Inc. http://www.sybase.com. For more
* information on the Open Source PowerBuilder Foundation Class
* Libraries see http://pfc.codexchange.sybase.com
*/
//
//////////////////////////////////////////////////////////////////////////////
long ll_DelLen, ll_Pos, ll_Count, ll_Start, ll_Length
string ls_holder
//Check for NULL
IF IsNull(as_source) or IsNull(as_delimiter) Then
long ll_null
SetNull(ll_null)
Return ll_null
End If
//Check for at leat one entry
If Trim (as_source) = '' Then
Return 0
End If
//Get the length of the delimeter
ll_DelLen = Len(as_Delimiter)
ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter))
//Only one entry was found
if ll_Pos = 0 then
as_Array[1] = as_source
return 1
end if
//More than one entry was found - loop to get all of them
ll_Count = 0
ll_Start = 1
Do While ll_Pos > 0
//Set current entry
ll_Length = ll_Pos - ll_Start
ls_holder = Mid (as_source, ll_start, ll_length)
// Update array and counter
ll_Count ++
as_Array[ll_Count] = ls_holder
//Set the new starting position
ll_Start = ll_Pos + ll_DelLen
ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter), ll_Start)
Loop
//Set last entry
ls_holder = Mid (as_source, ll_start, Len (as_source))
// Update array and counter if necessary
if Len (ls_holder) > 0 then
ll_count++
as_Array[ll_Count] = ls_holder
end if
//Return the number of entries found
Return ll_Count
[類似的問題(http://groups.google.com/group/sybase.public.powerbuilder.powerscript/browse_thread/thread/379c3c2af8bd968f/0b2bde1bea45ee96?lnk=raot&pli = 1)sybase.public.powerbuilder.powerscript – Sjoerd 2010-06-30 07:42:37